From 9db13a3e7410f38a62a02e7109ec565f22944d13 Mon Sep 17 00:00:00 2001 From: Brian Rogers Date: Fri, 3 Sep 2021 16:35:33 -0400 Subject: [PATCH] Fix Rachio service missing with 1st generation controllers (#55679) --- homeassistant/components/rachio/device.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/rachio/device.py b/homeassistant/components/rachio/device.py index 6669a353094..8ac4c92582f 100644 --- a/homeassistant/components/rachio/device.py +++ b/homeassistant/components/rachio/device.py @@ -70,9 +70,6 @@ class RachioPerson: can_pause = True break - if not can_pause: - return - all_devices = [rachio_iro.name for rachio_iro in self._controllers] def pause_water(service): @@ -97,6 +94,16 @@ class RachioPerson: if iro.name in devices: iro.stop_watering() + hass.services.async_register( + DOMAIN, + SERVICE_STOP_WATERING, + stop_water, + schema=STOP_SERVICE_SCHEMA, + ) + + if not can_pause: + return + hass.services.async_register( DOMAIN, SERVICE_PAUSE_WATERING, @@ -111,13 +118,6 @@ class RachioPerson: schema=RESUME_SERVICE_SCHEMA, ) - hass.services.async_register( - DOMAIN, - SERVICE_STOP_WATERING, - stop_water, - schema=STOP_SERVICE_SCHEMA, - ) - def _setup(self, hass): """Rachio device setup.""" rachio = self.rachio @@ -134,7 +134,7 @@ class RachioPerson: for controller in devices: webhooks = rachio.notification.get_device_webhook(controller[KEY_ID])[1] # The API does not provide a way to tell if a controller is shared - # or if they are the owner. To work around this problem we fetch the webooks + # or if they are the owner. To work around this problem we fetch the webhooks # before we setup the device so we can skip it instead of failing. # webhooks are normally a list, however if there is an error # rachio hands us back a dict