Patch rachio (#30031)

* fix binary sensor offline/online

fixed self._handle_update on line 66 to produce args, kwargs.
Updated the binary sensor to check the correct index in the tuple.

* Fixed Standby switch

Set standby switch to poll in order to get status when homeassistant starts up.
Updated the index for the switch to get the status from the tuple.
This commit is contained in:
omriasta 2019-12-18 15:04:54 -05:00 committed by Paulus Schoutsen
parent d16011b849
commit bdef54de0c
2 changed files with 6 additions and 6 deletions

View file

@ -63,7 +63,7 @@ class RachioControllerBinarySensor(BinarySensorDevice):
return
# For this device
self._handle_update()
self._handle_update(args, kwargs)
@abstractmethod
def _poll_update(self, data=None) -> bool:
@ -119,9 +119,9 @@ class RachioControllerOnlineBinarySensor(RachioControllerBinarySensor):
def _handle_update(self, *args, **kwargs) -> None:
"""Handle an update to the state of this sensor."""
if args[0][KEY_SUBTYPE] == SUBTYPE_ONLINE:
if args[0][0][KEY_SUBTYPE] == SUBTYPE_ONLINE:
self._state = True
elif args[0][KEY_SUBTYPE] == SUBTYPE_OFFLINE:
elif args[0][0][KEY_SUBTYPE] == SUBTYPE_OFFLINE:
self._state = False
self.schedule_update_ha_state()