Handle case when device can be None (#29171)

This commit is contained in:
Robert Svensson 2019-11-27 23:14:19 +01:00 committed by Paulus Schoutsen
parent 88441d5f68
commit bdb3eb1683

View File

@ -299,7 +299,11 @@ async def async_validate_trigger_config(hass, config):
trigger = (config[CONF_TYPE], config[CONF_SUBTYPE])
if device.model not in REMOTES or trigger not in REMOTES[device.model]:
if (
not device
or device.model not in REMOTES
or trigger not in REMOTES[device.model]
):
raise InvalidDeviceAutomationConfig
return config