Periodic action pipes
Use Periodic action pipes on a data piece, a group, a Freeform section, a custom screen, or a custom bottom sheet when you want Lua or JavaScript to change how components look on a clock — for example blink an alarm. This is not a Timer data source. A Timer source fetches or ticks inbound data. Periodic action pipes only change display while that data piece, group, section, screen, or bottom sheet is visible.
On a group, select the group. Those pipes use the group's data source and its value. In the script, comp is the group and components is only the components inside the group. If a data piece pipe writes the same property, the group's pipe wins for that group and its components. Ungroup asks you to confirm, then removes the group's pipes.
Open them on the data piece (data piece editor with nothing selected), in the section editor of a Freeform section (after the Root data source), or on a custom screen or bottom sheet (after the root data source). The group lists every pipe. Each row shows how many actions are on and the interval. The switch on the right turns that pipe on or off. Tap a row to edit it. Drag the handle to reorder pipes, and swipe right to left to delete a pipe. Add... creates a pipe and opens it.
Inside a pipe, set Interval (ms) (minimum 100; default 500). Add Lua or JavaScript. Each action can still be Always run, Run if, or Do not run if. There is no Debounce, Stop pipeline, HTTP, or tap-only action here.
Each pipe has its own interval and its own tick count. If two pipes write the same property, the pipe lower in the list wins. A tap still wins over every pipe.
The list runs when the data piece, group, Freeform section, custom screen, or bottom sheet is on screen and you are not previewing an AI change. Switching section, covering the screen, or sending the app to the background stops it. Coming back runs immediately, then on the interval.
Runtime writes such as components.alarm.visible are for display only. They are not saved. A tap still wins over these writes. Data piece transformers and periodic action pipes can target the same property without erasing each other.
The last value of a tick is discarded. Keep state across ticks in vars.
Keep pipes cheap
Periodic pipes run on a clock, so they cost the most. Put them at the widest level that does the job: a Freeform section or a data piece first, then a group. Use a pipe on a group only when the task needs it.
If one pipe can do several things, put them all in one Lua or JavaScript action. Do not split them into several actions or pipes. Pick the largest interval that still looks right.
Names you can use
| Name | Meaning |
|---|---|
value |
Current value for this tick. On a data piece: after data piece transformers, before a tap changes what is shown. On a group: after the group's transformers, before a tap changes what is shown. When Inherited is on, the group's transformers do not run, so this is the parent's value. On a Freeform section, custom screen, or bottom sheet: the root source value, or empty if unbound. Later actions in the same tick can change it. |
raw |
Fixed for the tick: value as it was when the tick started, before the first action changed it. |
ctx.intervalMs |
This pipe's interval. Not ctx.transport.intervalMs from a Timer source. |
ctx.tick |
How many runs this pipe has started, including failed ones. Pauses do not reset it. Other pipes have their own count. |
env |
App-wide text from ENV variables. |
vars |
Runtime store that lasts across ticks. See Runtime vars. |
components |
Other components by id. Assignments are display-only. |
comp |
Data piece look (bgColorId, visible, …). On a group, the group itself. Not available on a Freeform section, custom screen, or bottom sheet. |
params |
Custom screen and bottom sheet only: values passed when it opened. |
Read another source with source_value("Name") / source_raw("Name"). Those are sampled when the tick starts.
See Lua, JavaScript, Incoming data flow, and Tap actions.
Example
Blink alarm when the value is above 80; otherwise keep it visible:
local on = (ctx.tick % 2) == 0
if (tonumber(value) or 0) > 80 then
components.alarm.visible = on
else
components.alarm.visible = true
end
To blink the data piece background, switch comp.bgColorId between two colors:
if (ctx.tick % 2) == 0 then
comp.bgColorId = "error"
else
comp.bgColorId = "surface"
end
Blink only while it matters, for example during an alarm.