Skip to content

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, 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 expressionless variable, all you do is create a variable but leave the expression field blank. The variable will then have no value other than what you assign to it.

For 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, it will always be a string; if you use expression substitution, the data type will be whatever type the expression result produces.

By default, assigning a new value to a rule-based variable does not cause re-evaluation of other variables, even if the changed variable is specifically named in other expressions. However, you can force re-evaluation by checking the "Force re-evaluation of expressions and conditions" checkbox. Whether or not you need it checked depends specifically on your use case and the way you've set up your expressions and conditions; if you're not sure, leave it unchecked (the default) and evaluate your logic performance carefully.

See also: Expressions

Updated: 2021-Jun-08