Adjust Rachio logging level when adding shared controllers (#44323)
* change logging level * unnecessary continue * Clean up Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
14432248b0
commit
0fddaedc12
1 changed files with 13 additions and 5 deletions
|
@ -32,6 +32,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
ATTR_DEVICES = "devices"
|
ATTR_DEVICES = "devices"
|
||||||
ATTR_DURATION = "duration"
|
ATTR_DURATION = "duration"
|
||||||
|
PERMISSION_ERROR = "7"
|
||||||
|
|
||||||
PAUSE_SERVICE_SCHEMA = vol.Schema(
|
PAUSE_SERVICE_SCHEMA = vol.Schema(
|
||||||
{
|
{
|
||||||
|
@ -78,11 +79,18 @@ class RachioPerson:
|
||||||
# webhooks are normally a list, however if there is an error
|
# webhooks are normally a list, however if there is an error
|
||||||
# rachio hands us back a dict
|
# rachio hands us back a dict
|
||||||
if isinstance(webhooks, dict):
|
if isinstance(webhooks, dict):
|
||||||
_LOGGER.error(
|
if webhooks.get("code") == PERMISSION_ERROR:
|
||||||
"Failed to add rachio controller '%s' because of an error: %s",
|
_LOGGER.info(
|
||||||
controller[KEY_NAME],
|
"Not adding controller '%s', only controllers owned by '%s' may be added",
|
||||||
webhooks.get("error", "Unknown Error"),
|
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
|
continue
|
||||||
|
|
||||||
rachio_iro = RachioIro(hass, self.rachio, controller, webhooks)
|
rachio_iro = RachioIro(hass, self.rachio, controller, webhooks)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue