1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Make device automation type an enum (#62354)

This commit is contained in:
Ville Skyttä
2021-12-20 20:16:30 +02:00
committed by GitHub
parent 2ddd45afd5
commit 334c6c5c02
12 changed files with 120 additions and 43 deletions

View File

@@ -254,7 +254,7 @@ async def async_validate_action_config(
elif action_type == cv.SCRIPT_ACTION_DEVICE_AUTOMATION:
platform = await device_automation.async_get_device_automation_platform(
hass, config[CONF_DOMAIN], "action"
hass, config[CONF_DOMAIN], device_automation.DeviceAutomationType.ACTION
)
if hasattr(platform, "async_validate_action_config"):
config = await platform.async_validate_action_config(hass, config) # type: ignore
@@ -590,7 +590,9 @@ class _ScriptRun:
"""Perform the device automation specified in the action."""
self._step_log("device automation")
platform = await device_automation.async_get_device_automation_platform(
self._hass, self._action[CONF_DOMAIN], "action"
self._hass,
self._action[CONF_DOMAIN],
device_automation.DeviceAutomationType.ACTION,
)
await platform.async_call_action_from_config(
self._hass, self._action, self._variables, self._context