Update triggers to use HassJob (#41450)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
J. Nick KostonandPaulus Schoutsen authored and GitHub committed 2020-10-08 09:44:34 +02:00
1 parent 7537a3a7c8
commit b51a160cce
13 files changed
+55 -41

No files matched your search

+4 -3
View File
@@ -8,7 +8,7 @@ from homeassistant.const import (
CONF_PLATFORM,
CONF_ZONE,
)
from homeassistant.core import callback
from homeassistant.core import HassJob, callback
from homeassistant.helpers import condition, config_validation as cv, location
from homeassistant.helpers.event import async_track_state_change_event
@@ -37,6 +37,7 @@ async def async_attach_trigger(hass, config, action, automation_info):
entity_id = config.get(CONF_ENTITY_ID)
zone_entity_id = config.get(CONF_ZONE)
event = config.get(CONF_EVENT)
job = HassJob(action)
@callback
def zone_automation_listener(zone_event):
@@ -65,8 +66,8 @@ async def async_attach_trigger(hass, config, action, automation_info):
and not to_match
):
description = f"{entity} {_EVENT_DESCRIPTION[event]} {zone_state.attributes[ATTR_FRIENDLY_NAME]}"
hass.async_run_job(
action,
hass.async_run_hass_job(
job,
{
"trigger": {
"platform": "zone",