Commit Graph

74 Commits (a9f19a16ee3e2a625832ffda6a0520ff2035edc5)

Author SHA1 Message Date
Martin Hjelmare c8a53c564a Wait for future mysensors gateway ready (#14398)
* Wait for future mysensors gateway ready

* Add an asyncio future that is done when the gateway reports the
  gateway ready message, I_GATEWAY_READY.
* This will make sure that the gateway is ready before home assistant
  fires the home assistant start event. Automations can now send
  messages to the gateway when home assistant is started.
* Use async timeout to wait max 15 seconds for ready gateway.

* Address comments
2018-05-19 18:33:52 -04:00
Martin Hjelmare 7562b4164b Fix key error upon missing node (#14460)
* This is needed after gateway ready message generates an update while
  persistence is off, or while the gateway node hasn't been presented
  yet.
2018-05-14 22:52:44 +02:00
Martin Hjelmare be3b227a87
Make mysensors component async (#13641)
* Make mysensors component async

* Use async dispatcher and discovery.
* Run I/O in executor.
* Make mysensors actuator methods async.
* Upgrade pymysensors to 0.13.0.
* Use async serial gateway.
* Use async TCP gateway.
* Use async mqtt gateway.

* Start gateway before hass start event

* Make sure gateway is started after discovery of persistent devices
  and after corresponding platforms have been loaded.
* Don't wait to start gateway until after hass start.

* Bump pymysensors to 0.14.0
2018-05-11 09:39:18 +02:00
Paulus Schoutsen 83d300fd11 Custom component loading cleanup (#14211)
* Clean up custom component loading

* Fix some tests

* Fix some stuff

* Make imports work again

* Fix tests

* Remove debug print

* Lint
2018-05-01 20:57:30 +02:00
Martin Hjelmare c8f2810fac Make mysensors updates and platform setup async (#13603)
* Use async updates but keep methods that interact with mysensors
  gateway thread, eg turn_on and turn_off, non async.
* Use Python 3.5 async syntax.
2018-04-01 08:36:26 -07:00
Martin Hjelmare 5fce2e2b47 Fix mysensors update callback (#13602)
* Add callback annotation to mysensors dispatch callback.
2018-03-31 17:45:50 -07:00
Otto Winter 27c1806897 Python 3.5 adjustments (#13173) 2018-03-15 13:10:54 +02:00
Paulus Schoutsen f8a0a0ba59 Fix mysensor defaults (#12687) 2018-02-26 17:01:00 +01:00
Otto Winter 8dcfd35b8b Spelling fixes (#12041)
* Spelling fixes

*Lots* of them.

* Spelling breaking changes

* Fix lint errors
2018-01-29 23:37:19 +01:00
Fabian Affolter 47e31dc9ee Fixes for PEP257 (#11810)
* Fixes for PEP257

* More updates
2018-01-20 22:35:38 -08:00
Pascal Vizeli 90f9a6bc0a Cleanup and simplitfy the async state update (#9390)
* Cleanup and simplitfy the async state update

* Update test_entity.py
2017-09-12 10:01:03 +02:00
Martin Hjelmare 274e4449ea Fix possible KeyError (#9242)
* Multiple devices per child per platform would lead to KeyError.
2017-08-31 21:00:09 +02:00
Martin Hjelmare b8d737c0cc Upgrade pymysensors to 0.11.1 (#9212) 2017-08-29 17:10:28 +02:00
EmitKiwi 654f6892f9 Mysensors nodes can be renamed in config file (#9123)
* Mysensors nodes can be renamed in the config file

* Replace nodes array with dict. Replace whole name of the node.

* Improved iteration on node names
2017-08-27 20:40:38 +02:00
Martin Hjelmare 8775c54d29 Refactor mysensors callback and add validation (#9069)
* Refactor mysensors callback and add validation

* Add mysensors entity class. The mysensors entity class inherits from
  a more general mysensors device class.
* Extract mysensors name function.
* Add setup_mysensors_platform for mysensors platforms.
* Add mysensors const schemas.
* Update mysensors callback and add child validation.
* Remove gateway wrapper class.
* Add better logging for mysensors callback.
* Add discover_persistent_devices function.
* Remove discovery in mysensors component setup.
* Clean up gateway storage in hass.data.
* Update all mysensors platforms.
  * Add repr for MySensorsNotificationDevice.
  * Fix bug in mysensors climate target temperatures.
  * Clean up platforms. Child validation simplifies assumptions in
    platforms.
  * Remove not needed try except statements. All messages are validated
    already in pymysensors.
* Clean up logging.
* Add timer debug logging if callback is slow.
* Upgrade pymysensors to 0.11.0.

* Make dispatch callback async

* Pass tuple device_args and optional add_devices

* Also return new_devices as list instead of dictionary.
2017-08-25 08:58:05 -07:00
Martin Hjelmare 47034f83f4 Upgrade pymysensors to 0.10.0 (#7469) 2017-05-06 19:10:17 -07:00
Andrey 2c1df75c07 Switch russound, pymysensors, and pocketcasts to pypi (#7449)
* Switch russound to pypi

* Switch pymysensors to pypi

* Switch pocketcasts to pypi
2017-05-07 02:22:38 +02:00
Fabian Affolter 203f48cadc Update docstrings (#7420) 2017-05-03 10:11:39 +02:00
Fabian Affolter 4d52b0ecd5 Update docstrings (#7405)
* Update docstrings

* Fix lint issues

* Update docstrings
2017-05-02 22:47:20 +02:00
Fabian Affolter 3ee4d1060f Update docstrings (#7361)
* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update tomato.py

* Update isy994.py

* Lint + fix tests

* Lint
2017-04-29 22:04:49 -07:00
Martin Hjelmare 4e388666b2 Fix mysensors callback (#7057)
* Fix mysensors callback

* All messages was not triggering proper updates. Fix by checking all
  child value types each update.

* Upgrade mysensors dep

* Fix pickle persistence when upgrading.
2017-04-11 19:17:09 -07:00
Martin Hjelmare 749f79e813 Upgrade mysensors dep and callbacks (#6950) 2017-04-06 00:21:21 -07:00
Martin Hjelmare 13dd17b2ab Fix mysensors gateway windows setup (#6500) 2017-03-11 03:30:23 +01:00
Paulus Schoutsen 2650c73a89 Split bootstrap into bs + setup (#6416)
* Split bootstrap into bs + setup

* Lint
2017-03-05 10:41:54 +01:00
Martin Hjelmare bafa0cc3b8 Fix mysensors callback race (#6311)
* Fix possible race at startup in mysensors callback

* Update devices via persistence before starting gateway to avoid
  two threads calling the same callback at the same time.

* Call add_devices max once per callback
2017-03-01 23:09:27 +01:00
Martin Hjelmare 45a7c27280 Add mysensors device tracker and platform discovery (#5781)
* Add mysensors device_tracker platform

* Add discovery of device_tracker platforms

* Enable discovery of device_tracker platforms that are not
  DeviceScanner.
* Update signature of setup_scanner function in all affected platforms.
* Add test.
* Use discovery for mysensors device_tracker platform.

* Remove gps accuracy

* Small change to core like schema

* fix depency
2017-02-07 20:47:11 +01:00
Martin Hjelmare 82c99f81fc Fix validation of serial port on windows (#5749)
* Fix validation of serial port on windows

* Use pyserial to check serial ports.
* Check that persistence file ends with either `.json` or `.pickle`.

* Change fix to not rely on pyserial

* Use generator expr instead of list comprehension
2017-02-04 21:54:20 -08:00
Martin Hjelmare a09a772f43 Add more validation for mysensors (#5493)
* Move isdevice validator under helpers.config_validation.
* Check that all persistence files are set and are unique if any is set
  by user. This is necessary to avoid file name clashes.
* Check that a set persistence file has an existing and writable
  directory.
* Check that a device is either a valid device file, "mqtt", or a valid
  domain name or ip address.
2017-01-24 22:04:44 -08:00
Martin Hjelmare 9db1aa7629 Add discovery notify support and mysensors notify (#5219)
* Add mysensors notify platform

* Make add_devices optional in platform callback function.
* Use new argument structure for all existing mysensors platforms.
* Add notify platform.
* Update mysensors gateway.

* Refactor notify setup

* Enable discovery of notify platforms.
* Update and add tests for notify component and some platforms.
* Continue setup of notify platforms if a platform fails setup.
* Remove notify tests that check platform config. These tests are not
  needed when config validation is used.
* Add config validation to APNS notify platform.
* Use discovery to set up mysensors notify platform.

* Add discovery_info to get_service and update tests

* Add discovery_info as keyword argument to the get_service function
  signature and update all notify platforms.
* Update existing notify tests to check config validation using test
  helper.
* Add removed tests back in that checked config in apns, command_line
  and file platforms, but use config validation test helper to verify
  config.
* Add a test for notify file to increase coverage.
* Fix some PEP issues.

* Fix comments and use more constants

* Move apns notify service under notify domain
2017-01-15 03:53:14 +01:00
Martin Hjelmare 734bd75fd3 Fix mysensors overwriting gateway in GATEWAYS (#4013)
GATEWAYS was a dict, so would overwrite item if key was the same. This
would happen when using multiple MQTT gateways, since the device id is
the same (`mqtt`).

* Fix by changing GATEWAYS from dict into list.
* Use hass data to store mysensors gateways instead of having GATEWAYS
  be a global.
2016-11-06 10:49:43 -08:00
Fabian Affolter be272ac64a Disable too-many-* (#4107)
* Disable too-many-* and too-few-public-methods

* Remove globally disabled pylint warnings
2016-10-30 22:18:53 +01:00
Martin Hjelmare a05fb4cef8 Upgrade pymysensors to 0.8 (#3954) 2016-10-20 20:56:26 +02:00
Otto Winter d5f8aa52c4 Add support for MySensors cover (#3512)
* Added support for MySensors cover device

* Fixed set_req not defined

* Fixed V_PERCENTAGE is str

* Removed set_cover_position

The MySensors documentation doesn’t specify when sending a V_PERCENTAGE
is allowed.

* Fixed homeassistant/components/mysensors.py line too long

* Fixed lint ATTR_POSITION imported but unused

* Use V_PERCENTAGE for MySensors cover

* Revert "Removed set_cover_position"

This reverts commit d78cb3a04d.

* Fix set_req, ATTR_POSITION not defined

* Added support for non-exactly positionable covers

* Fixed V_PERCENTAGE cast to bool

* Ported MySensors cover back to v1.4

`V_PERCENTAGE` and `V_DIMMER` are aliases just like `V_STATUS` and
`V_LIGHT`, so the code inside `MySensorsCover` doesn’t need to be
updated.

* Fixed v1.5 V_TYPES not in in v1.4 gateway SetReq
2016-10-01 01:36:04 +02:00
kaustubhphatak 7625aae373 Add support for mysensors HVAC device (#3405)
* Added Support for mysensnors Climate/HVAC device

* Added Support for mysensnors-hvac device:fix pylint error

* Added Support for mysensnors-hvac device:fix pylint error2

* Fixed Issues in code as per review comments

* Fixed Linter Errors

* Fixed Linter Errors:2

* Fixed Linter Errors:2

* Fixed Linter Errors

* Fixed Linter Errors

* Fixed Linter Errors

* Added Support for MySensors HVAC| Fixed Review Comments| Removed Additional Comments

* Added Support for MySensors HVAC| Fixed Review Comments Itr2

* Changes to correctly support devices with both high and low bound temperatures

* Changed to optimize the code
2016-09-22 23:47:40 -07:00
Martin Hjelmare 6acaf25b0d Use voluptuous for mysensors (#2992)
* Add voluptuous config validation for mysensors
* Remove and clean up parts that are not needed for pymysensors 0.7.
2016-08-27 14:41:21 -06:00
MartinHjelmare d1e94b958f Extract mqtt string into constant and add log 2016-08-25 19:07:22 +02:00
MartinHjelmare e7b206da0c Add MQTT gateway for MySensors
* Use mqtt component to enable a MySensors MQTT gateway.
* Setup the MQTT gateway if mysensors config has mqtt as a value for
	the key	device in the list of gateways.
* Simplify two lines in the mqtt component.
2016-08-24 10:48:55 +02:00
Henning Dickten a12dadab5e Update pymysensors version to 0.7.1 2016-08-21 12:47:40 +02:00
Henning Dickten 7d0c50a106 Update pymysensors version to 0.7 2016-08-20 22:45:55 +02:00
Teagan M. Glenn 26526ca57a Add unit system support
Add unit symbol constants

Initial unit system object

Import more constants

Pydoc for unit system file

Import constants for configuration validation

Unit system validation method

Typing for constants

Inches are valid lengths too

Typings

Change base class to dict - needed for remote api call serialization

Validation

Use dictionary keys

Defined unit systems

Update location util to use metric instead of us fahrenheit

Update constant imports

Import defined unit systems

Update configuration to use unit system

Update schema to use unit system

Update constants

Add imports to core for unit system and distance

Type for config

Default unit system

Convert distance from HASS instance

Update temperature conversion to use unit system

Update temperature conversion

Set unit system based on configuration

Set info unit system

Return unit system dictionary with config dictionary

Auto discover unit system

Update location test for use metric

Update forecast unit system

Update mold indicator unit system

Update thermostat unit system

Update thermostat demo test

Unit tests around unit system

Update test common hass configuration

Update configuration unit tests

There should always be a unit system!

Update core unit tests

Constants typing

Linting issues

Remove unused import

Update fitbit sensor to use application unit system

Update google travel time to use application unit system

Update configuration example

Update dht sensor

Update DHT temperature conversion to use the utility function

Update swagger config

Update my sensors metric flag

Update hvac component temperature conversion

HVAC conversion for temperature

Pull unit from sensor type map

Pull unit from sensor type map

Update the temper sensor unit

Update yWeather sensor unit

Update hvac demo unit test

Set unit test config unit system to metric

Use hass unit system length for default in proximity

Use the name of the system instead of temperature

Use constants from const

Unused import

Forecasted temperature

Fix calculation in case furthest distance is greater than 1000000 units

Remove unneeded constants

Set default length to km or miles

Use constants

Linting doesn't like importing just for typing

Fix reference

Test is expecting meters - set config to meters

Use constant

Use constant

PyDoc for unit test

Should be not in

Rename to units

Change unit system to be an object - not a dictionary

Return tuple in conversion

Move convert to temperature util

Temperature conversion is now in unit system

Update imports

Rename to units

Units is now an object

Use temperature util conversion

Unit system is now an object

Validate and convert unit system config

Return the scalar value in template distance

Test is expecting meters

Update unit tests around unit system

Distance util returns tuple

Fix location info test

Set units

Update unit tests

Convert distance

DOH

Pull out the scalar from the vector

Linting

I really hate python linting

Linting again

BLARG

Unit test documentation

Unit test around is metric flag

Break ternary statement into if/else blocks

Don't use dictionary - use members

is metric flag

Rename constants

Use is metric flag

Move constants to CONST file

Move to const file

Raise error if unit is not expected

Typing

No need to return unit since only performing conversion if it can work

Use constants

Line wrapping

Raise error if invalid value

Remove subscripts from conversion as they are no longer returned as tuples

No longer tuples

No longer tuples

Check for numeric type

Fix string format to use correct variable

Typing

Assert errors raised

Remove subscript

Only convert temperature if we know the unit

If no unit of measurement set - default to HASS config

Convert only if we know the unit

Remove subscription

Fix not in clause

Linting fixes

Wants a boolean

Clearer if-block

Check if the key is in the config first

Missed a couple expecting tuples

Backwards compatibility

No like-y ternary!

Error handling around state setting

Pretty unit system configuration validation

More tuple crap

Use is metric flag

Error handling around min/max temp

Explode if no unit

Pull unit from config

Celsius has a decimal

Unused import

Check if it's a temperature before we try to convert it to a temperature

Linting says too many statements - combine lat/long in a fairly reasonable manner

Backwards compatibility unit test

Better doc
2016-08-04 22:02:19 -07:00
Paulus Schoutsen a65a122464 Fix discovery (#2305) 2016-06-14 22:51:46 -07:00
Paulus Schoutsen 30f74bb3ca Migrate to generic discovery method (#2271)
* Migrate to generic discovery method

* Add tests for discovery
2016-06-11 17:43:13 -07:00
Martin Hjelmare 069a4b1706 Refactor mysensors component
* Add MySensorsDeviceEntity class to hold the common attributes,
	properties and methods for mysensors entities.
* Inherit from MySensorsDeviceEntity class in binary_sensor, light,
	sensor and switch mysensors platforms.
* Remove not needed attribute and method for const in GatewayWrapper
	class. The const attribute is already set in the wrapped object.
* Clean up state property for mysensors sensor entities.
* Inherit from MySensorsLightRGB in MySensorsLightRGBW class.
* Remove use of get_component in mysensors component and platforms.
* Clean up update method in MySensorsDeviceEntity class.
2016-04-30 15:27:59 +02:00
Paulus Schoutsen 9d391becc1 Add mysensors tcp ethernet gateway (#1861)
* Bump version of pymysensors to 0.6, which includes the tcp gateway.
* Update requirements_all.txt.
* Replace CONF_PORT with CONF_DEVICE and ATTR_PORT with ATTR_DEVICE.
* Add tcp_port in config.
* Try to guess if tcp or serial gateway is configured, by validating
	device name as an ip address. If successful setup tcp gateway, if it
	fails, setup serial gateway.
* Update device_state_attributes to show correct device, ethernet or
	serial.
2016-04-19 21:00:56 -07:00
Paulus Schoutsen 2e79e9d5bb Correct celcius to celsius (#1860) 2016-04-19 20:30:44 -07:00
Øystein Hansen 8b986b0b97 mysensors.py Prevent sensor name mixup (#1802)
Change the sensor name schema so nodes are not mixed up. The dot that was pressent before was ignored by home-assistant.
Before name:  <skeatchname> <node_id><child_id>  eg. wall 107
New name   :  <skeatchname> <node_id> <child_id>  eg. wall 10 7
This will result in a Home Assistant Entity ID of: sensor.wall_10_7
2016-04-13 21:22:40 -07:00
Jan Harkes 3383854506 Move CONF_OPTIMISTIC to homeassistant.const. 2016-04-06 22:51:39 -04:00
Fabian Affolter b534244e40 Fix PEEP257 issues 2016-03-08 17:55:57 +01:00
Fabian Affolter b8a40457ee Update docstrings to match PEP257 2016-03-07 18:50:30 +01:00
MartinHjelmare bfa579f8b2 Add assumed_state to mysensors switch and light
* Return true for assumed_state if optimistic config setting is true.
* Fix PEP257
2016-03-01 03:09:55 +01:00