Flow Variables
Variables are the data layer of your flows. They store values that blocks can read, write, and compare — connecting sensor readings to decisions and actuator actions.
Local vs Global Variables
Local Variables
| Property | Description |
|---|---|
| Scope | This flow only |
| ID Prefix | var_1, var_2, … |
| Lifetime | Created when the flow starts, deleted when it ends |
| Purpose | Temporary storage for intermediate values during flow execution |
Use local variables for:
- Storing a sensor reading to compare it later in the same flow
- Holding a calculated dosing amount
- Temporary counters or flags
Global Variables
| Property | Description |
|---|---|
| Scope | Shared across flows and programs |
| ID Prefix | global_1, global_2, … |
| Lifetime | Persist between flow executions |
| Purpose | Target values, thresholds, and shared data that programs can override |
| Fields | Name, Unit, Description, Default Value, Tolerance |
Use global variables for:
- Target setpoints (e.g.,
target_ph = 6.5,target_ec = 1.8) - Thresholds that programs can override per schedule
- Values that need to survive between flow runs
The Key Difference: Overrides
Global variables can be overridden by Programs. When a Program loads a flow, it can set custom values for global variables per time window. This is what makes flows reusable.
How it works:
- You create a flow with global variable
target_ec(default: 1.5) - A Program includes this flow in two time windows:
- Morning →
target_ecoverridden to 1.8 - Night →
target_ecoverridden to 1.2
- Morning →
- The flow is identical, but the behavior changes based on the schedule
Local variables cannot be overridden — they always start with their default value (or undefined) each time the flow runs.
Opening the Variable Manager
Click the Variables button in the editor toolbar. The manager opens as a dialog with two tabs:
| Tab | Shows |
|---|---|
| Local (count) | All local variables for this flow |
| Global (count) | All global variables for this flow |
Creating a Variable
Adding a Local Variable
- Switch to the Local tab
- Click + Add Local
- The edit dialog opens with a generated ID (
var_1) - Fill in:
| Field | Required | Description |
|---|---|---|
| Name | ✅ | Human-readable name (e.g., “Current pH”) |
| Unit | ✅ | The measurement unit — must be selected from the unit picker |
Adding a Global Variable
- Switch to the Global tab
- Click + Add Global
- Fill in:
| Field | Required | Description |
|---|---|---|
| Name | ✅ | Human-readable name (e.g., “Target pH”) |
| Unit | ✅ | The measurement unit |
| Enable Tolerance | ❌ | Whether this variable has tolerance (±) settings |
| Description | ❌ | Explains what this variable represents |
| Default Value | ❌ | The starting value if no Program override is set |
| Default Tolerance | ❌ | The range around the value that’s considered acceptable |
Tolerance
Tolerance defines what counts as “close enough” to the target value:
| Mode | Symbol | Meaning | Example (value=6.5, tolerance=0.2) |
|---|---|---|---|
| Symmetric | ± | Both directions | Acceptable: 6.3 – 6.7 |
| Positive | + | Only above | Acceptable: 6.5 – 6.7 |
| Negative | - | Only below | Acceptable: 6.3 – 6.5 |
How Variables Are Referenced in Blocks
When a block field supports variables, a Var toggle button appears next to the input:
| Mode | Input |
|---|---|
| Fixed value | Regular number/text input |
| Variable | Variable selector dropdown — choose from all flow variables |
When a variable is selected, it’s stored as {{variable_id}} (e.g., {{global_1}}). The engine resolves this to the actual value at runtime.
Which blocks write variables?
| Block | When |
|---|---|
| Sensor Read | Writes the sensor value to the selected target variable |
Which blocks read variables?
| Block | Fields That Can Use Variables |
|---|---|
| Actuator Set | Duration, Amount (dosing) |
| IF (Condition) | Variable to check, Comparison value |
| Loop | Iteration count, Timeout, Interval, Stop condition |
| Wait | Duration |
Flow Health Dashboard — Variable Analysis
When no block is selected, the Properties Panel shows the Flow Health Dashboard, which includes a Variable Matrix. It flags issues:
| Badge | Color | Meaning |
|---|---|---|
| Unused | Red | Variable exists but no block reads or writes it |
| Write Only | Yellow | A block writes to it, but nothing reads it |
| Read Only | Orange | A block reads it, but nothing writes to it |
Unit Conversion
Values are stored internally in base units (e.g., Celsius for temperature, milliliters for volume). When you enter or view values, the system automatically converts between the display unit and the base unit.
Best Practices
- Name descriptively —
target_phis better thanvar_1. - Use globals for targets — anything a Program might want to change should be global.
- Use locals for readings — sensor values only needed during one flow run should be local.
- Always set default values for globals — if no Program override exists, the flow needs a fallback.
- Enable tolerance for setpoints — defines what “close enough” means for comparisons.
- Check the Health Dashboard — look for unused and write-only variables.
- Match units carefully — mismatched units trigger validation errors.
Troubleshooting
“Save” button disabled in edit dialog
- A unit must be selected. Click the unit picker and choose one.
Variable not showing in block selector
- Make sure the variable has been saved. Close the Variable Manager and reopen the block properties.
Red “unit mismatch” error on Sensor Read block
- The sensor’s output unit doesn’t match the target variable’s unit.
“Unused” badge on a variable
- No block reads or writes it. Either connect it to a block or delete it.
“Read Only” badge
- A block tries to read this variable, but nothing writes to it. Add a Sensor Read block that writes to this variable, or set a default value.