Skip to content

Commit dcbdce4

Browse files
authored
Improve docstrings of event helpers related to state changes (home-assistant#148722)
1 parent 50047f0 commit dcbdce4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

homeassistant/helpers/event.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,10 @@ def async_track_state_change_event(
316316
Unlike async_track_state_change, async_track_state_change_event
317317
passes the full event to the callback.
318318
319+
The action will not be called immediately, but will be scheduled to run
320+
in the next event loop iteration, even if the action is decorated with
321+
@callback.
322+
319323
In order to avoid having to iterate a long list
320324
of EVENT_STATE_CHANGED and fire and create a job
321325
for each one, we keep a dict of entity ids that
@@ -866,6 +870,10 @@ def async_track_state_change_filtered(
866870
) -> _TrackStateChangeFiltered:
867871
"""Track state changes with a TrackStates filter that can be updated.
868872
873+
The action will not be called immediately, but will be scheduled to run
874+
in the next event loop iteration, even if the action is decorated with
875+
@callback.
876+
869877
Args:
870878
hass:
871879
Home assistant object.
@@ -1348,9 +1356,13 @@ def async_track_template_result(
13481356
then whenever the output from the template changes. The template will
13491357
be reevaluated if any states referenced in the last run of the
13501358
template change, or if manually triggered. If the result of the
1351-
evaluation is different from the previous run, the listener is passed
1359+
evaluation is different from the previous run, the action is passed
13521360
the result.
13531361
1362+
The action will not be called immediately, but will be scheduled to run
1363+
in the next event loop iteration, even if the action is decorated with
1364+
@callback.
1365+
13541366
If the template results in an TemplateError, this will be returned to
13551367
the listener the first time this happens but not for subsequent errors.
13561368
Once the template returns to a non-error condition the result is sent

0 commit comments

Comments
 (0)