From d8cf4cb57f1a16791262b93063f68c0b130d678b Mon Sep 17 00:00:00 2001 From: Thibaut Etienne Date: Mon, 5 Oct 2020 19:19:41 +0000 Subject: [PATCH 1/2] Handle error 404 during setup --- homeassistant/components/somfy/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/homeassistant/components/somfy/__init__.py b/homeassistant/components/somfy/__init__.py index fbc76e7c93811f..1e5a252afc9eaf 100644 --- a/homeassistant/components/somfy/__init__.py +++ b/homeassistant/components/somfy/__init__.py @@ -179,3 +179,4 @@ async def update_all_devices(hass): data[DEVICES] = await hass.async_add_executor_job(data[API].get_devices) except HTTPError as err: _LOGGER.warning("Cannot update devices: %s", err.response.status_code) + data[DEVICES] = [] From 0a0ccefb8b6ee0e8d6ac07f741c915bdff5851e8 Mon Sep 17 00:00:00 2001 From: Thibaut Etienne Date: Tue, 6 Oct 2020 10:00:48 +0000 Subject: [PATCH 2/2] Set devices to empty during the setup --- homeassistant/components/somfy/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/somfy/__init__.py b/homeassistant/components/somfy/__init__.py index 1e5a252afc9eaf..7b1430b19c03f9 100644 --- a/homeassistant/components/somfy/__init__.py +++ b/homeassistant/components/somfy/__init__.py @@ -89,6 +89,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry): ) hass.data[DOMAIN][API] = api.ConfigEntrySomfyApi(hass, entry, implementation) + hass.data[DOMAIN][DEVICES] = [] await update_all_devices(hass) @@ -179,4 +180,3 @@ async def update_all_devices(hass): data[DEVICES] = await hass.async_add_executor_job(data[API].get_devices) except HTTPError as err: _LOGGER.warning("Cannot update devices: %s", err.response.status_code) - data[DEVICES] = []