@@ -336,16 +336,16 @@ function.
336336
337337.. code :: python
338338
339- @state_trigger (str_expr, ... , state_hold = None , state_hold_false = None , state_check_now = False , kwargs = None )
339+ @state_trigger (str_expr, ... , state_hold = None , state_hold_false = None , state_check_now = False , kwargs = None , watch = None )
340340
341341 ``@state_trigger `` takes one or more string arguments that contain any expression based on one or
342- more state variables, and evaluates to ``True `` or ``False `` (or non-zero or zero). Whenever any
343- of the state variables or attribute values mentioned in the expression change, the expression is
344- evaluated and the trigger occurs if it evaluates to ``True `` (or non-zero). For each state variable,
345- eg: ``domain.name ``, the prior value is also available to the expression as `` domain.name.old ``
346- in case you want to condition the trigger on the prior value too. Attribute values can be used
347- in the expression too, using the forms ``domain.name.attr `` and `` domain.name.old.attr `` for
348- the new and old attribute values respectively.
342+ more state variables, and evaluates to ``True `` or ``False `` (or non-zero or zero). Whenever any of
343+ the state variables or attribute values mentioned in the expression change (or specified via the
344+ `` watch `` argument), the expression is evaluated and the trigger occurs if it evaluates to ``True ``
345+ (or non-zero). For each state variable, eg: ``domain.name ``, the prior value is also available to
346+ the expression as `` domain.name.old `` in case you want to condition the trigger on the prior value
347+ too. Attribute values can be used in the expression too, using the forms ``domain.name.attr `` and
348+ `` domain.name.old.attr `` for the new and old attribute values respectively.
349349
350350Multiple ``str_expr `` arguments are logically "or"ed together into a single expression. Any argument
351351can alternatively be a list or set of strings, and they are treated the same as multiple arguments
@@ -401,14 +401,14 @@ Optional arguments are:
401401 occurred.
402402
403403``watch=None ``
404- Specifies a list or set of string state variable names (entity names) that are monitored for
405- this trigger. When (and only when) any variable in this set changes, the trigger expression
406- is evaluated. Normally this set of names is automatically extracted from the `` @state_trigger ``
407- expression, but there could be cases where it doesn't capture all the names (eg, if you have to
408- use ``state.get() `` inside the trigger expression). You could also use `` watch `` to specify a
409- subset of the names in the trigger expression, which has the effect of rendering those other
410- variables as only conditions in the trigger expression that won't cause a trigger themselves,
411- since the expression won't be evaluated when they change.
404+ Specifies a list or set of string state variable names (entity names) or state attributes that are
405+ monitored for this trigger. When (and only when) a variable in this set changes, the trigger
406+ expression is evaluated. Normally this set of names is automatically extracted from the
407+ `` @state_trigger `` expression, but there could be cases where it doesn't capture all the names
408+ (eg, if you have to use ``state.get() `` inside the trigger expression). You could also use
409+ `` watch `` to specify a subset of the names in the trigger expression, which has the effect of
410+ rendering those other variables as only conditions in the trigger expression that won't cause
411+ a trigger themselves, since the expression won't be evaluated when they change.
412412
413413Here's a summary of the trigger behavior with these parameter settings:
414414
0 commit comments