ENV variables
Store text you reuse across the dashboard — a host, a token, a shared string — once, then insert it wherever fields accept expressions.
Open from the menu: Data → ENV variables.
Fields
| Field | What to enter |
|---|---|
| Key | The name you type later, for example mqtt_host. Latin lowercase letters (a–z), numbers, and underscores. Must not start with a number. Typed letters are stored in lowercase. At most 50 characters. |
| Value | The text to insert. At most 500 characters. The field is hidden while you type; tap Reveal to see it and Hide to hide it again. |
| Description | Optional. Write it so the assistant understands the variable. At most 200 characters. |
How to insert a variable
- In fields that fill in
{{ }}:{{ env.my_key }} - In a simple expression, Lua, or JavaScript:
env.my_key - In JSONPath when the path uses
env:$.env.my_key
Example: store the broker host as mqtt_host, then put {{ env.mqtt_host }} in the MQTT connection host field.
JSON values
If a value is a JSON object or array, for example {"host": "broker.local", "port": 1883}, the app reads it as that object. Read its fields with a dot: env.my_key.host, {{ env.my_key.port }}, $.env.my_key.host. Lua and JavaScript get a ready table or object, so you don't need json_decode or JSON.parse. {{ env.my_key }} in a text field inserts the whole JSON as text. A value that is not valid JSON stays plain text.
The API key in AI settings and the Password of an MQTT connection have an env button next to the field. Tap it to choose a variable or add a new one, and the app inserts {{ env.my_key }} into the field.
Where it works
- Data source fields — URL, headers, parameters, body, MQTT Topic filters (subscribe), WebSocket Rooms and Message events, Default value
- Tap actions — send URL, topics, events, headers, body, Open URL, and similar
- Data destinations — URL, topics, events, headers, body, Text to send
- MQTT and WebSocket connection settings — host, URL, credentials, headers, and similar
- AI settings → API key
It does not expand inside the ENV variables editor itself. Values are stored as you type them.
Missing keys
If you write env.my_key and that key does not exist, it is empty: {{ env.my_key }} fills in nothing. Add a fallback with {{ env.my_key ?? "default" }}.
A field whose expression fails (for example a typo in a name) is not filled in:
- In a data source or connection field, that fetch, subscribe, tick, or connect is skipped. MQTT and WebSocket keep the last successful subscribe.
- In a tap action, the rest of the tap stops. See Tap actions.
When a value changes
Changing a variable updates interpolating sources and reconnects interpolating MQTT and WebSocket connections. Transformers and tap actions use the new value the next time data arrives or you tap.
AI assistant
The assistant sees names and descriptions only. It cannot read values. If it needs a password or token, it may ask you to confirm a variable name, or it may open a sheet where you enter the Key, Value, and Description. The value stays on this device and is never sent to the assistant. You can also add or edit variables here yourself.
Saved with your setup
ENV variables are stored with the rest of the encrypted configuration. Export and snapshots include them, so a variable you add on one device also works on another device after you import the file. See Settings and configuration safety.
Runtime vars
vars is a second app-wide store. Scripts fill it while the app runs — a counter, the last token, a list you build up between taps or ticks. It differs from ENV variables:
ENV variables (env) |
Runtime vars |
|
|---|---|---|
| Who sets values | You, in Data → ENV variables | Scripts, while the app runs |
| Kind of value | Text, or a JSON object or array | Any: text, number, true/false, list, object |
| Saved | Yes, with your configuration | No. Values are gone after the app restarts. Importing a configuration and Delete current configuration also clear them |
Write a value from a script:
- Lua:
vars.my_key = value. Set it tonilto remove the key. - JavaScript:
vars.my_key = value. Set it tonullto remove the key. - Simple expression:
vars_set("my_key", value). It stores the value and also returns it.
Keys use lowercase Latin letters, numbers, and underscores, must not start with a number, and are at most 50 characters. Write keys in lowercase: vars.rotSpeed is stored as rotspeed, so the next read of vars.rotSpeed finds nothing. Use vars.rot_speed instead.
Read a value anywhere env works:
- In a simple expression, Lua, or JavaScript:
vars.my_key - In JSONPath:
$.vars.my_key - In fields that fill in
{{ }}:{{ vars.my_key }}
A missing key is nil in Lua and empty (null) in a simple expression or {{ }} field, the same as a missing ENV variable. Add a fallback with vars.my_key ?? "default". When a value changes, fields that use it update the same way as for ENV variables.
The assistant can read current vars values to help you check a script. It cannot change them.
Custom screen params
On a custom screen, params holds the values passed when the screen opened. Read params.room in transformers and tap actions (Lua, JavaScript, simple expressions), $.params.room in JSONPath, and {{ params.room }} in component fields. params exists only on custom screens.
See also
- Menu and navigation
- Expressions, Lua, JavaScript, JSONPath
- Expressions in editors — which names work in each editor
- Data sources, Tap actions
- AI assistant