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

Add support for for to binary_sensor, light and switch device triggers (#26658)

* Add support for `for` to binary_sensor, light and switch device triggers

* Add WS API device_automation/trigger/capabilities
This commit is contained in:
Erik Montnemery
2019-10-02 22:14:52 +02:00
committed by GitHub
parent d8c6b281b8
commit 65ce3b49c1
21 changed files with 495 additions and 42 deletions

View File

@@ -10,7 +10,12 @@ import voluptuous as vol
import homeassistant.components.device_automation as device_automation
from homeassistant.core import HomeAssistant, Context, callback, CALLBACK_TYPE
from homeassistant.const import CONF_CONDITION, CONF_DEVICE_ID, CONF_TIMEOUT
from homeassistant.const import (
CONF_CONDITION,
CONF_DEVICE_ID,
CONF_DOMAIN,
CONF_TIMEOUT,
)
from homeassistant import exceptions
from homeassistant.helpers import (
service,
@@ -89,7 +94,7 @@ async def async_validate_action_config(
if action_type == ACTION_DEVICE_AUTOMATION:
platform = await device_automation.async_get_device_automation_platform(
hass, config, "action"
hass, config[CONF_DOMAIN], "action"
)
config = platform.ACTION_SCHEMA(config)
@@ -346,7 +351,7 @@ class Script:
self.last_action = action.get(CONF_ALIAS, "device automation")
self._log("Executing step %s" % self.last_action)
platform = await device_automation.async_get_device_automation_platform(
self.hass, action, "action"
self.hass, action[CONF_DOMAIN], "action"
)
await platform.async_call_action_from_config(
self.hass, action, variables, context