Device automation config error message improvements (#44656)
Refs #44654, #44655
This commit is contained in:
parent
e2964ca878
commit
da66a4e933
3 changed files with 17 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Add table
Reference in a new issue