core/homeassistant/components/cover
Greg Laabs 1c8b5838cd ISY994 sensor improvements (#10805)
* Fire events for ISY994 control events

This allows hass to react directly to Insteon button presses (on switches and remotes), including presses, double-presses, and long holds

* Move change event subscription to after entity is added to hass

The event handler method requires `self.hass` to exist, which doesn't have a value until the async_added_to_hass method is called. Should eliminate a race condition.

* Overhaul binary sensors in ISY994 to be functional "out of the box"

We now smash all of the subnodes from the ISY994 in to one Hass binary_sensor, and automatically support both paradigms of state reporting that Insteon sensors can do. Sometimes a single node's state represents the sensor's state, other times two nodes are used and only "ON" events are sent from each. The logic between the two forunately do not conflict so we can support both without knowing which mode the device is in.

This also allows us to handle the heartbeat functionality that certain sensors have - we simply store the timestamp of the heartbeat as an attribute on the sensor device. It defaults to Unknown on bootup if and only if the device supports heartbeats, due to the presence of subnode 4.

* Parse the binary sensor device class from the ISY's device "type"

Now we automatically know which sensors are moisture, motion, and openings! (We also reverse the moisture sensor state, because Insteon reports ON for dry on the primary node.)

* Code review tweaks

The one material change here is that the event subscribers were moved to the `async_added_to_hass` method, as the handlers depend on things that only exist after the entity has been added.

* Handle cases where a sensor's state is unknown

When the ISY first boots up, if a battery-powered sensor has not reported in yet (due to heartbeat or a change in state), the state is unknown until it does.

* Clean up from code review

Fix coroutine await, remove unnecessary exception check, and return None when state is unknown

* Unknown value from PyISY is now -inf rather than -1

* Move heartbeat handling to a separate sensor

Now all heartbeat-compatible sensors will have a separate `binary_sensor` device that represents the battery state (on = dead)

* Add support for Unknown state, which is being added in next PyISY 

PyISY will report unknown states as the number "-inf". This is implemented in the base ISY994 component, but subcomponents that override the `state` method needed some extra logic to handle it as well.

* Change a couple try blocks to explicit None checks

* Bump PyISY to 1.1.0, now that it has been published!

* Remove -inf checking from base component

The implementation of the -inf checking was improved in another branch which has been merged in to this branch already.

* Restrict negative-node and heartbeat support to known compatible types

Not all Insteon sensors use the same subnode IDs for the same things, so we need to use different logic depending on device type. Negative node and heartbeat support is now only used for leak sensors and open/close sensors.

* Use new style string formatting

* Add binary sensor detection for pre-5.x firmware

Meant to do this originally; writing documentation revealed that this requirement was missed!
2017-12-13 20:14:56 -08:00
..
__init__.py Fix async probs (#9924) 2017-10-19 10:56:25 +02:00
abode.py Abode services, events, lights, cameras, automations, quick actions. (#9310) 2017-09-18 17:39:41 +02:00
command_line.py Fix pylint 1.7.2 no-else-return issues (#8361) 2017-07-05 23:30:01 -07:00
demo.py Fix COMMAND_CLASS_BARRIER_OPERATOR for dev branch of OpenZwave (#8574) 2017-07-27 18:57:30 -04:00
garadget.py Do not call update() in constructor (#8878) 2017-08-08 20:21:33 +02:00
homematic.py WIP: Homematic improvments with new hass interfaces (#9058) 2017-08-31 21:16:44 +02:00
isy994.py ISY994 sensor improvements (#10805) 2017-12-13 20:14:56 -08:00
knx.py Fix typo within cover/knx https://github.com/XKNX/xknx/issues/64 (#9527) 2017-09-21 21:55:33 +02:00
lutron_caseta.py upgrade to new pylutron_caseta with TLS (#10286) 2017-11-10 12:17:25 +01:00
mqtt.py Add code to enable discovery for mqtt cover (#10580) 2017-11-14 20:19:15 -08:00
myq.py Persistent notification import (#8507) 2017-07-16 21:39:38 +02:00
mysensors.py Refactor mysensors callback and add validation (#9069) 2017-08-25 08:58:05 -07:00
opengarage.py Fix pylint 1.7.2 no-else-return issues (#8361) 2017-07-05 23:30:01 -07:00
rflink.py missing is_closed ( rflink cover fix ) (#9776) 2017-10-09 16:57:44 +02:00
rfxtrx.py Refactor rfxtrx (#9117) 2017-08-29 16:22:28 +02:00
rpi_gpio.py added invert_state optional parameter (#8695) 2017-07-31 20:24:21 -04:00
scsgate.py Update docstrings (#7361) 2017-04-29 22:04:49 -07:00
services.yaml Update services.yaml files (#10229) 2017-10-30 21:39:12 +01:00
tahoma.py Tahoma platform for Somfy Covers and Sensors (#10652) 2017-11-19 21:35:13 +01:00
tellduslive.py Update docstrings (#7361) 2017-04-29 22:04:49 -07:00
tellstick.py Added support for cover in tellstick (#10858) 2017-12-10 17:35:10 +01:00
template.py WIP: Cleanup async stuff on templates (#10275) 2017-11-01 15:48:09 +01:00
velbus.py Velbus (#8076) 2017-07-26 14:03:29 +02:00
vera.py Added Vera scenes (#10424) 2017-12-07 07:47:19 +01:00
wink.py Fix some issues for PyLint 1.7.2 (#8356) 2017-07-05 20:02:16 -07:00
xiaomi_aqara.py Rename xiaomi #9425 (#9426) 2017-09-14 18:49:03 -04:00
zwave.py Fix Z-Wave barrier discovery for new API (#8706) 2017-07-30 00:40:56 -04:00