Documentation / Hardware

Automations

Things that happen without a finger: timers, edges, thresholds and variable changes.

An automation is an event raised by the hardware or by time rather than by a finger on the screen. It has a trigger and a list of actions, exactly like a widget event, and it is evaluated inside app_poll() on every refresh. Automations live on the Data tab under the variables.

Two automations under the variables: a periodic tick and a digital input edge, each with its action list.
Two automations under the variables: a periodic tick and a digital input edge, each with its action list.

Triggers

TriggerParametersNotes
On startupDelay (ms)Runs once, after the UI has been created.
Every intervalInterval (ms), Also run at startupA periodic tick. Each run is due an interval after the last one was due, so a counter kept by a one-second tick keeps time. The period you set is the period it runs at, on every export (Arduino, MicroPython, ESPHome and ESP-IDF). Before 2026-10-21 an ESPHome interval always ran every second; a saved design is corrected when it is opened or exported.
Digital input changesInput, EdgeDebounced in the generated poll loop. "Active" respects the input's active-low setting.
Digital input heldInput, Hold time (ms)Fires once per press, after the input has been active continuously for the hold time.
Analog crosses thresholdAnalog input, When it, Threshold, HysteresisCompared against the scaled value. Hysteresis stops it chattering around the threshold.
Variable changesVariable, Condition, ValueEvaluated after every variable refresh.
Encoder turnedEncoder, DirectionA rotary encoder from Hardware > Inputs. Runs once for every click of the knob, so three clicks run it three times. Arduino export.
Encoder pressedEncoder, When it isThe push switch in the knob's shaft, debounced: pressed, or let go. It needs the encoder's Push switch pin. Arduino export.
Screen went offnoneOnce each time the screen goes dark: its time with nothing happening ran out, or Screen off now was done. See Screen off when idle. On ESPHome it is on_pause.
Screen wokenoneOnce each time a dark screen lights again: a touch, motion, the wake button or Wake the screen. A screen that was only dimmed does not count. On ESPHome it is on_resume.
Wake word heardnoneOnce each time the wake word (“Hi ESP”) is said. The board then listens for a command for a few seconds. Needs Wake words and spoken commands. Arduino export, ESP32-S3. Not run in Preview.
Command heardCommandOnce each time that command is said after the wake word. The Command list is the one under Wake words and spoken commands. One command is heard for each wake word. Arduino export, ESP32-S3. Not run in Preview.

Actions

The same list a widget event offers - Change Screen, Set/Modify Flag, Set Property, Increment Slider, Play Animation, Call function and the rest - plus the hardware actions:

A Call function run by an automation is handed NULL for the event, since nothing was touched: see Your own code.

An automation with no actions, or an action with a required field empty, is an error.

Patterns

Generated code

Each automation becomes a block in app_poll() that keeps whatever state it needs - the last timer tick, the previous input level and the time it went active, whether an analog value is currently above or below its threshold, the previous variable value - and calls the generated action sequence when its condition is met. Debounce and hysteresis are applied in the generated code, so a chattering input or a reading hovering at the threshold fires once.

In the preview

Press Play and the automations a browser can know the trigger of are run, with the firmware's own arithmetic: On startup, Every interval and Variable changes. A counter counts, a threshold on a variable fires, and the Console says what each one did - once, and again when what it says changes, so a one-second tick does not fill it.

The ones that watch a pin, an analog reading or an encoder are not run: there is nothing in a browser for them to watch. Their logic is simple enough to read in app_logic.cpp if you want to check it.