Add websocket trigger/condition commands (#39109)

This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2020-08-24 23:01:57 +02:00
1 parent d5193e64de
commit 2a1fe9d29a
10 files changed
+204 -61

No files matched your search

+11 -12
View File
@@ -54,18 +54,17 @@ async def async_attach_trigger(
def call_action(*_):
"""Call action with right context."""
hass.async_run_job(
action(
{
"trigger": {
"platform": "template",
"entity_id": entity_id,
"from_state": from_s,
"to_state": to_s,
"for": time_delta if not time_delta else period,
}
},
context=(to_s.context if to_s else None),
)
action,
{
"trigger": {
"platform": "template",
"entity_id": entity_id,
"from_state": from_s,
"to_state": to_s,
"for": time_delta if not time_delta else period,
}
},
(to_s.context if to_s else None),
)
if not time_delta: