From 0fddaedc1254efeb96826b95033519d5d293c13e Mon Sep 17 00:00:00 2001 From: Brian Rogers Date: Fri, 18 Dec 2020 15:15:08 -0500 Subject: [PATCH] Adjust Rachio logging level when adding shared controllers (#44323) * change logging level * unnecessary continue * Clean up Co-authored-by: Martin Hjelmare --- homeassistant/components/rachio/device.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/rachio/device.py b/homeassistant/components/rachio/device.py index 2ef904f8680..c9de7eea7d4 100644 --- a/homeassistant/components/rachio/device.py +++ b/homeassistant/components/rachio/device.py @@ -32,6 +32,7 @@ _LOGGER = logging.getLogger(__name__) ATTR_DEVICES = "devices" ATTR_DURATION = "duration" +PERMISSION_ERROR = "7" PAUSE_SERVICE_SCHEMA = vol.Schema( { @@ -78,11 +79,18 @@ class RachioPerson: # webhooks are normally a list, however if there is an error # rachio hands us back a dict if isinstance(webhooks, dict): - _LOGGER.error( - "Failed to add rachio controller '%s' because of an error: %s", - controller[KEY_NAME], - webhooks.get("error", "Unknown Error"), - ) + if webhooks.get("code") == PERMISSION_ERROR: + _LOGGER.info( + "Not adding controller '%s', only controllers owned by '%s' may be added", + controller[KEY_NAME], + self.username, + ) + else: + _LOGGER.error( + "Failed to add rachio controller '%s' because of an error: %s", + controller[KEY_NAME], + webhooks.get("error", "Unknown Error"), + ) continue rachio_iro = RachioIro(hass, self.rachio, controller, webhooks)