Set Variable Action
The Set Variable action allows you to set the value of an expression-less Reactor variable. Expression-less variables are a common Reactor paradigm for storing temporary data, such as a mode, a counter/index value, or the previous/current state of a switch or setpoint of a thermostat, before changing it (you can then change it back to that previous value later). To create an expression-less variable, all you do is create a variable but leave the expression field blank. The variable will then take no value other than what you assign to it.
Expression-less variables only!
You are not allowed to change the value of a variable that has an expression associated with it. These variables always have the last evaluation result, and are read-only.
To set a variable value, choose the name of the variable from the dropdown list, and supply a constant value, or you can use the substitution form to specify an expression: ${{ temperature * 1.8 + 32 }}
. If you supply a constant value with no substitution, it will always be a string; if you use expression substitution as the entire value, the data type will be whatever type the expression result produces.
Consider using Script Action
Many users now prefer to use a Script Action when setting a variable to an expression result, assigning the value to the variable in the usual way (i.e. variableName = expression
). The script in a Script Action is generally regarded as easier to read and support because you don't have to use the awkward substitution syntax. This is particularly true when you need a multi-step or multi-line expression to get the work done.
Setting Global Variables
When assigning a value to a global variable, any dependent global variables are automatically re-evaluated and updated (unless the dependent variable has auto-evaluate turned off). Dependent variables are those that refer to the target of the Set Variable action. For example, if you have two global variables, where A
is an expression-less variable and B
is defined by the expression A * A
, then whenever A
is modified, B
will be recomputed automatically using the new value of A
.
If a global variable is used by a Rule-based local variable, or in a Rule's trigger condition, the Rule will be marked for re-evaluation — its local variables and trigger states will be updated and considered, and the Rule may SET or RESET as the trigger conditions direct.
Setting Rule-based Local Variables
When assigning a value to a Rule-based local variable, dependent Rule-local variables are automatically re-evaluated and updated (see definition of dependent variables under Global Variables above).
Retesting Rule Triggers on Local Variable Changes
When using the Set Variable action in a Rule's SET or RESET Reaction, a Force re-evaluation of expressions and conditions checkbox is available on the action. By default this checkbox is off. When turned on for a variable, a change to that variable will cause the Rule's triggers to be re-evaluated, and if necessary, the Rule will change state.
Normally, one would only turn this checkbox on for Rule-local variables that are used in trigger expressions, so that the triggers are re-checked after the variable is modified, and the Rule can respond (or not) using the new value. Using this feature when not needed may cause excess and unnecessary re-evaluations of the Rule and increase system load (in addition to other potential side-effects). If you're not sure, leave it unchecked/off.
See also: Expressions & Variables and Script Action
Updated: 02-Sep-2025