From a7f4cf7167834774c75cfb5fdc32441aa488ed2e Mon Sep 17 00:00:00 2001 From: Dmitry Mamontov Date: Sat, 20 Mar 2021 12:38:36 +0300 Subject: [PATCH] Fix Key Error --- custom_components/miwifi/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/custom_components/miwifi/__init__.py b/custom_components/miwifi/__init__.py index 9a99fd6..fe8edfd 100644 --- a/custom_components/miwifi/__init__.py +++ b/custom_components/miwifi/__init__.py @@ -41,6 +41,8 @@ async def async_setup(hass: HomeAssistant, config: dict) -> bool: if DOMAIN not in config: return success + hass.data.setdefault(DOMAIN, {}) + for router in config[DOMAIN]: hass.data[DOMAIN][router[CONF_IP_ADDRESS]] = router