hass-core/homeassistant/components/switch
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 Fixed bug with all switch devices being excluded (#9555) 2017-09-24 08:22:15 +02:00
acer_projector.py Fix a bunch of typos (#9545) 2017-09-23 17:15:46 +02:00
ads.py Add ADS component (#10142) 2017-12-05 09:44:22 +01:00
android_ip_webcam.py Fix a bunch of typos (#9545) 2017-09-23 17:15:46 +02:00
anel_pwrctrl.py
arduino.py
arest.py Fix some issues for PyLint 1.7.2 (#8356) 2017-07-05 20:02:16 -07:00
bbb_gpio.py Fix some issues for PyLint 1.7.2 (#8356) 2017-07-05 20:02:16 -07:00
broadlink.py pad packets to multiple of 4 characters (#10560) 2017-11-14 09:18:06 +01:00
command_line.py Do not call update() in constructor (#8892) 2017-08-08 22:36:59 +02:00
deluge.py Add Deluge Switch Component (#9979) 2017-10-24 16:44:12 +02:00
demo.py
digital_ocean.py
digitalloggers.py Fix and optimize digitalloggers platform (#9203) 2017-08-29 15:38:42 +02:00
dlink.py Change attribute names (#9277) 2017-09-03 16:07:12 +02:00
doorbird.py DoorBird Component (#9281) 2017-09-17 20:47:30 +02:00
edimax.py
enocean.py
flux.py Move constant to 'const.py' and use already definied ones (#10204) 2017-10-29 12:32:02 +01:00
fritzdect.py Update fritzhome to 1.0.3 (#9951) 2017-10-18 20:57:53 +02:00
gc100.py Add gc100 platforms and component (#10159) 2017-10-30 08:40:14 +01:00
hdmi_cec.py
hikvisioncam.py Fix Hikvision (motion) switch bug (#10608) 2017-11-16 01:15:45 +01:00
hive.py New Hive Component / Platforms (#9804) 2017-11-23 13:10:23 +01:00
homematic.py WIP: Homematic improvments with new hass interfaces (#9058) 2017-08-31 21:16:44 +02:00
hook.py Fix some issues for PyLint 1.7.2 (#8356) 2017-07-05 20:02:16 -07:00
insteon_local.py Refactored to new global json saving and loading (#10677) 2017-11-19 19:47:55 -08:00
insteon_plm.py Fix a bunch of typos (#9545) 2017-09-23 17:15:46 +02:00
isy994.py ISY994 sensor improvements (#10805) 2017-12-13 20:14:56 -08:00
kankun.py
knx.py renamed add_devices to async_add_devices according to hass naming scheme (second try after failed #9485) (#9505) 2017-09-20 01:15:20 -04:00
linode.py Linode (#9936) 2017-10-27 16:19:47 +02:00
litejet.py Do not call update() in constructor (#8878) 2017-08-08 20:21:33 +02:00
lutron_caseta.py upgrade to new pylutron_caseta with TLS (#10286) 2017-11-10 12:17:25 +01:00
mfi.py Fix some issues for PyLint 1.7.2 (#8356) 2017-07-05 20:02:16 -07:00
mochad.py Serialize mochad requests (#11029) 2017-12-08 09:18:52 -08:00
modbus.py Modbus switch register support (#10563) 2017-11-15 22:17:10 -08:00
mqtt.py Cleanup and simplitfy the async state update (#9390) 2017-09-12 10:01:03 +02:00
mysensors.py Refactor mysensors callback and add validation (#9069) 2017-08-25 08:58:05 -07:00
mystrom.py
neato.py Refactor Neato botvac components as a vacuum (#9946) 2017-11-03 14:25:26 +01:00
netio.py
orvibo.py
pilight.py Pilight switch: restore last state after restart (#8580) 2017-08-22 16:40:14 +02:00
pulseaudio_loopback.py Fix some issues for PyLint 1.7.2 (#8356) 2017-07-05 20:02:16 -07:00
qwikswitch.py
rachio.py Remove not needed call to update (#8930) 2017-08-11 19:55:57 -07:00
rainbird.py cleanup 2017-10-24 12:25:12 +02:00
raincloud.py Introducing support to Melnor RainCloud sprinkler systems (#9287) 2017-09-29 10:08:41 +02:00
rainmachine.py Fixes (#9912) 2017-10-17 09:24:52 +02:00
raspihats.py
rest.py Add HTTP Basic auth to RESTful Switch (#9162) 2017-09-09 10:20:48 -07:00
rflink.py Add test cases and fix for device_defaults fire_event option. (#9567) 2017-09-24 15:47:59 -07:00
rfxtrx.py Refactor rfxtrx (#9117) 2017-08-29 16:22:28 +02:00
rpi_gpio.py Fix some issues for PyLint 1.7.2 (#8356) 2017-07-05 20:02:16 -07:00
rpi_pfio.py
rpi_rf.py
scsgate.py
services.yaml Update services.yaml files (#10229) 2017-10-30 21:39:12 +01:00
skybell.py Skybell (#9681) 2017-10-08 20:14:39 +02:00
snmp.py Upgrade pysnmp to 4.4.2 (#10539) 2017-11-13 09:24:07 -08:00
tellduslive.py
tellstick.py Tellstick Duo acync callback fix (#10384) 2017-11-09 15:03:35 +01:00
telnet.py Telnet switch (#8913) 2017-09-18 17:35:35 +02:00
template.py WIP: Cleanup async stuff on templates (#10275) 2017-11-01 15:48:09 +01:00
tesla.py Tesla bug fixes. (#9774) 2017-10-09 14:38:00 +03:00
thinkingcleaner.py
toon.py Fix PEP8 and PEP257 issues (#10108) 2017-10-24 18:36:08 +02:00
tplink.py Allow disabling the LEDs on TP-Link smart plugs (#10980) 2017-12-06 08:38:27 +01:00
transmission.py
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
verisure.py
volvooncall.py
vultr.py Add platform and sensors for Vultr VPS (#9928) 2017-11-05 14:10:14 +01:00
wake_on_lan.py Do not call update() in constructor (#8878) 2017-08-08 20:21:33 +02:00
wemo.py Fix pylint 1.7.2 no-else-return issues (#8361) 2017-07-05 23:30:01 -07:00
wink.py Moved siren to Wink from switch (#9879) 2017-10-20 10:18:32 -04:00
xiaomi_aqara.py Rename xiaomi #9425 (#9426) 2017-09-14 18:49:03 -04:00
xiaomi_miio.py python-miio version bumped for improved device support. (#10720) 2017-11-21 09:23:39 +01:00
zha.py
zigbee.py
zoneminder.py
zwave.py