Improve validation of device condition config (#27131)

* Improve validation of device condition config

* Fix typing
This commit is contained in:
Erik Montnemery 2019-10-03 00:58:14 +02:00 committed by Paulus Schoutsen
parent 363873dfcb
commit c43eeee62f
8 changed files with 269 additions and 21 deletions

View file

@ -96,7 +96,12 @@ async def async_validate_action_config(
platform = await device_automation.async_get_device_automation_platform(
hass, config[CONF_DOMAIN], "action"
)
config = platform.ACTION_SCHEMA(config)
config = platform.ACTION_SCHEMA(config) # type: ignore
if action_type == ACTION_CHECK_CONDITION and config[CONF_CONDITION] == "device":
platform = await device_automation.async_get_device_automation_platform(
hass, config[CONF_DOMAIN], "condition"
)
config = platform.CONDITION_SCHEMA(config) # type: ignore
return config