mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
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:
parent
d16011b849
commit
bdef54de0c
@ -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()
|
||||
|
@ -107,7 +107,7 @@ class RachioStandbySwitch(RachioSwitch):
|
||||
dispatcher_connect(
|
||||
hass, SIGNAL_RACHIO_CONTROLLER_UPDATE, self._handle_any_update
|
||||
)
|
||||
super().__init__(controller, poll=False)
|
||||
super().__init__(controller, poll=True)
|
||||
self._poll_update(controller.init_data)
|
||||
|
||||
@property
|
||||
@ -134,9 +134,9 @@ class RachioStandbySwitch(RachioSwitch):
|
||||
|
||||
def _handle_update(self, *args, **kwargs) -> None:
|
||||
"""Update the state using webhook data."""
|
||||
if args[0][KEY_SUBTYPE] == SUBTYPE_SLEEP_MODE_ON:
|
||||
if args[0][0][KEY_SUBTYPE] == SUBTYPE_SLEEP_MODE_ON:
|
||||
self._state = True
|
||||
elif args[0][KEY_SUBTYPE] == SUBTYPE_SLEEP_MODE_OFF:
|
||||
elif args[0][0][KEY_SUBTYPE] == SUBTYPE_SLEEP_MODE_OFF:
|
||||
self._state = False
|
||||
|
||||
self.schedule_update_ha_state()
|
||||
|
Loading…
x
Reference in New Issue
Block a user