Update triggers to use HassJob (#41450)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
parent
7537a3a7c8
commit
b51a160cce
13 changed files with 55 additions and 41 deletions
|
@ -3,7 +3,7 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components.geo_location import DOMAIN
|
||||
from homeassistant.const import CONF_EVENT, CONF_PLATFORM, CONF_SOURCE, CONF_ZONE
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.core import HassJob, callback
|
||||
from homeassistant.helpers import condition, config_validation as cv
|
||||
from homeassistant.helpers.config_validation import entity_domain
|
||||
from homeassistant.helpers.event import TrackStates, async_track_state_change_filtered
|
||||
|
@ -36,6 +36,7 @@ async def async_attach_trigger(hass, config, action, automation_info):
|
|||
source = config.get(CONF_SOURCE).lower()
|
||||
zone_entity_id = config.get(CONF_ZONE)
|
||||
trigger_event = config.get(CONF_EVENT)
|
||||
job = HassJob(action)
|
||||
|
||||
@callback
|
||||
def state_change_listener(event):
|
||||
|
@ -58,8 +59,8 @@ async def async_attach_trigger(hass, config, action, automation_info):
|
|||
and from_match
|
||||
and not to_match
|
||||
):
|
||||
hass.async_run_job(
|
||||
action,
|
||||
hass.async_run_hass_job(
|
||||
job,
|
||||
{
|
||||
"trigger": {
|
||||
"platform": "geo_location",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue