Fix exception when last Shelly device is removed (#45476)

pull/42560/head
Shay Levy 2021-01-27 15:15:56 +02:00 committed by GitHub
parent 80c2efa9f2
commit 5bc4db5ef9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -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]