Device automation config error message improvements (#44656)

Refs #44654, #44655
This commit is contained in:
Ville Skyttä 2020-12-31 01:02:14 +02:00 committed by GitHub
parent e2964ca878
commit da66a4e933
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 3 deletions

View file

@ -417,7 +417,15 @@ async def async_validate_trigger_config(hass, config):
or device.model not in REMOTES
or trigger not in REMOTES[device.model]
):
raise InvalidDeviceAutomationConfig
if not device:
raise InvalidDeviceAutomationConfig(
f"deCONZ trigger {trigger} device with id "
f"{config[CONF_DEVICE_ID]} not found"
)
raise InvalidDeviceAutomationConfig(
f"deCONZ trigger {trigger} is not valid for device "
f"{device} ({config[CONF_DEVICE_ID]})"
)
return config

View file

@ -169,7 +169,10 @@ async def async_get_condition_capabilities(hass, config):
)
if not state or not unit_of_measurement:
raise InvalidDeviceAutomationConfig
raise InvalidDeviceAutomationConfig(
"No state or unit of measurement found for "
f"condition entity {config[CONF_ENTITY_ID]}"
)
return {
"extra_fields": vol.Schema(

View file

@ -168,7 +168,10 @@ async def async_get_trigger_capabilities(hass, config):
)
if not state or not unit_of_measurement:
raise InvalidDeviceAutomationConfig
raise InvalidDeviceAutomationConfig(
"No state or unit of measurement found for "
f"trigger entity {config[CONF_ENTITY_ID]}"
)
return {
"extra_fields": vol.Schema(