Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rachio: Fix online sensor and standby switch #30031

Merged
merged 2 commits into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions homeassistant/components/rachio/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _handle_any_update(self, *args, **kwargs) -> None:
return

# For this device
self._handle_update()
self._handle_update(args, kwargs)

@abstractmethod
def _poll_update(self, data=None) -> bool:
Expand Down Expand Up @@ -119,9 +119,9 @@ def _poll_update(self, data=None) -> bool:

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()
6 changes: 3 additions & 3 deletions homeassistant/components/rachio/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __init__(self, hass, controller):
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
Expand All @@ -134,9 +134,9 @@ def _poll_update(self, data=None) -> bool:

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()
Expand Down