diff --git a/homeassistant/components/shelly/utils.py b/homeassistant/components/shelly/utils.py index 2a78343440b..97d8bda609b 100644 --- a/homeassistant/components/shelly/utils.py +++ b/homeassistant/components/shelly/utils.py @@ -172,6 +172,9 @@ def get_input_triggers( def get_device_wrapper(hass: HomeAssistant, device_id: str): """Get a Shelly device wrapper for the given device id.""" + if not hass.data.get(DOMAIN): + return None + for config_entry in hass.data[DOMAIN][DATA_CONFIG_ENTRY]: wrapper = hass.data[DOMAIN][DATA_CONFIG_ENTRY][config_entry][COAP]