mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 19:09:32 +00:00
Support dynamic schema validation in device conditions and actions (#52007)
* Allow integrations to provide dynamic schema validation in device conditions and actions * Add tests * re-add type * mypy
This commit is contained in:
@@ -256,7 +256,10 @@ 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) # type: ignore
|
||||
if hasattr(platform, "async_validate_action_config"):
|
||||
config = await platform.async_validate_action_config(hass, config) # type: ignore
|
||||
else:
|
||||
config = platform.ACTION_SCHEMA(config) # type: ignore
|
||||
|
||||
elif action_type == cv.SCRIPT_ACTION_CHECK_CONDITION:
|
||||
if config[CONF_CONDITION] == "device":
|
||||
|
||||
Reference in New Issue
Block a user