mirror of
https://github.com/home-assistant/core.git
synced 2025-08-14 01:55:18 +02:00
Guard against new and removed state change events (#7687)
This commit is contained in:
@@ -45,6 +45,7 @@ def async_trigger(hass, config, action):
|
|||||||
time_delta = config.get(CONF_FOR)
|
time_delta = config.get(CONF_FOR)
|
||||||
async_remove_state_for_cancel = None
|
async_remove_state_for_cancel = None
|
||||||
async_remove_state_for_listener = None
|
async_remove_state_for_listener = None
|
||||||
|
match_all = (from_state == MATCH_ALL and to_state == MATCH_ALL)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def clear_listener():
|
def clear_listener():
|
||||||
@@ -77,8 +78,8 @@ def async_trigger(hass, config, action):
|
|||||||
})
|
})
|
||||||
|
|
||||||
# Ignore changes to state attributes if from/to is in use
|
# Ignore changes to state attributes if from/to is in use
|
||||||
match_all = (from_state == MATCH_ALL and to_state == MATCH_ALL)
|
if (not match_all and from_s is not None and to_s is not None and
|
||||||
if not match_all and from_s.last_changed == to_s.last_changed:
|
from_s.last_changed == to_s.last_changed):
|
||||||
return
|
return
|
||||||
|
|
||||||
if time_delta is None:
|
if time_delta is None:
|
||||||
|
Reference in New Issue
Block a user