Handle case when device can be None (#29171)

This commit is contained in:
Robert Svensson authored and Paulus Schoutsen committed 2019-11-27 14:14:19 -08:00
1 parent 88441d5f68
commit bdb3eb1683
1 file changed
+5 -1
@@ -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