Get started: Timer source and live clock

This tutorial uses a Timer data source to drive a live clock on your dashboard. The source ticks every second; a Lua transformer on the source turns each tick into the current local time (hours, minutes, seconds — no date). A Label on a data piece shows the result.

Unlike HTTP, MQTT, or WebSocket, Timer doesn't fetch anything from the network. It emits a configured string on a timer, or on demand — useful when you need a steady heartbeat, a static placeholder, or test data without a backend.

When to use Timer

Use case How Timer helps
Live clock or periodic refresh Auto mode ticks on an interval; transformers can produce fresh output on every tick (this tutorial).
Combine or reformat other sources On each tick, a Lua or Simple expression transformer can read another source with source_value("Name") (after its transformers run) or source_raw("Name") (the raw message before transformers) — for example to merge HTTP JSON with a clock string, or refresh a derived label on a schedule. See Lua.
Static placeholder Emit a fixed label, JSON snippet, or default number until you wire up a real source.
Test data Try out data pieces, Labels, and transformers without setting up HTTP, MQTT, or WebSocket.
Manual refresh only Set Trigger to Manual and emit once from the source editor or a Trigger data source(s) tap action — no background timer.
Shared constant across data pieces One Timer source can feed many data pieces; each component can transform the same string differently.

See Data sources (incoming) for interval limits (minimum 100 ms) and trigger modes.

Before you begin

You need one data section on the home screen. If you already completed Get started: HTTP GET, reuse that section; otherwise create one (Add data section manually on the empty home screen, or from the menu).

1. Create a Timer data source

Open the menu (top-right) → Data sources → Add data source, or start from Add data piece → Data source → Add data source.

On the "New data source" screen:

  1. Set Name to Timer Clock.
  2. Set Data source type to Timer.
  3. Leave Default value empty (or type a placeholder such as -). The Lua transformer in the next section replaces it on every tick.
  4. Set Interval (ms) to 1000, so the source fires every second.
  5. Leave Trigger at Auto (periodic) (default).

Tap the save tick in the top-right.

2. Add a Lua transformer for the current time

Open Data sources → Timer Clock (or stay in the editor after step 1).

Under Data transformers pipe, tap Add... → Lua.

Enter a one-line script that returns the current local time without the date:

return os.date("%H:%M:%S")

Each tick runs this script on the configured Default value string and stores the result as the source's value. For UTC, use return os.date("!%H:%M:%S") — see Lua.

To remove the transformer later, swipe its row right to left in the editor.

3. Add a data piece

On an empty section, tap Add data piece manually or Ask AI assistant to add data piece. Or turn on Edit layout, tap Add at the top, then Add data piece. In the library, pick Design your own data piece.

Set the Timer source as the data piece root data source. Add a Label — it inherits that source.

The Label should show the time updating about once per second.

4. View the live clock on the dashboard

Back on the home screen, the data piece shows the current time and refreshes every second.

The displayed string changes even though the underlying Default value field is static — the Lua transformer on the source runs on every tick. Each tick also sets ctx.transport: reason (interval, trigger, defaultValue, or peer), intervalMs, and receivedAt. See Lua.

What you built

Part Role
Timer data source Ticks every 1000 ms in Auto mode and feeds the configured string into transformers
Lua (source transformer) return os.date("%H:%M:%S") — the current time on each tick
Data piece Root Timer source; a Label inherits it and shows the transformed clock

Next steps