Overview
Every Action needs a trigger—the event that starts its execution. Choosing the right trigger type determines how your automation responds to real-world conditions.When to Use Each Type
| Trigger Type | Use When | Example |
|---|---|---|
Time-Based (ON EVERY, ON TIMESTAMP) | You need a clock-driven schedule (interval or wall-clock) | Heartbeats, polling, shift windows, one-shot cutovers |
Topic-Based (ON TOPIC) | You need to react when data arrives | Sensor processing, command handling |
Initialization (ON START) | You need to run logic once when the broker starts | Bootstrap UNS structure, set default config values |
| Callable (no trigger) | You need reusable logic invoked by other actions | Utility functions, shared calculations |
In This Page
- Time-Based Triggers — Intervals, weekday/weekend rules, and
ON TIMESTAMP(daily or one-shot) - Topic-Based Triggers — React to MQTT messages with
ON TOPIC - Initialization Triggers — Run once at broker startup with
ON START - Callable Actions — Invoke manually or from other actions
Time-Based Triggers
LoT supports several time-based trigger forms. All of them use theON keyword and run the action’s DO block automatically—no MQTT message is required to fire them. Together they cover recurring intervals, calendar rules (a specific weekday, Monday–Friday, or Saturday–Sunday), daily wall-clock times, and single one-shot executions.
Quick reference
| Syntax | Pattern | Recurs? |
|---|---|---|
ON EVERY N UNIT | Every N seconds, minutes, hours, and so on | Yes — indefinitely |
ON EVERY DAY AT "HH:mm" | Named weekday at a fixed local time | Yes — every week |
ON EVERY WEEKDAY AT "HH:mm" | Monday–Friday at a fixed local time | Yes — every weekday |
ON EVERY WEEKEND AT "HH:mm" | Saturday–Sunday at a fixed local time | Yes — every weekend |
ON TIMESTAMP "HH:mm:ss" | Every day at a fixed local time | Yes — every day |
ON TIMESTAMP "dd-MM-yyyy HH:mm:ss" | Exact date and time | No — one-shot |
Time zone: For
HH:mm and HH:mm:ss in ON EVERY … AT and in daily ON TIMESTAMP, values are interpreted in the local time of the machine running the broker, then converted to UTC internally. The action is scheduled for the correct wall-clock time across daylight saving changes. The one-shot form dd-MM-yyyy HH:mm:ss is interpreted as UTC, as described below.Structured payloads:
PUBLISH TOPIC does not support inline JSON object literals. For multi-field records, define a COLLAPSED model and use PUBLISH MODEL … TO … WITH (see Publishing Models). The timed-action examples below use that pattern.1. ON EVERY N UNIT — fixed interval
Fires repeatedly every N units of time. Common for monitoring, polling, and heartbeats.
Supported units
| Keyword(s) | Example |
|---|---|
MILLISECOND / MS | ON EVERY 500 MS |
SECOND / SECONDS | ON EVERY 30 SECONDS |
MINUTE / MINUTES | ON EVERY 5 MINUTES |
HOUR / HOURS | ON EVERY 1 HOUR |
DAY / DAYS | ON EVERY 1 DAY |
WEEK / WEEKS | ON EVERY 2 WEEKS |
MONTH / MONTHS | ON EVERY 1 MONTH |
YEAR / YEARS | ON EVERY 1 YEAR |
Singular and plural unit names are interchangeable (for example,
1 SECOND and 1 SECONDS). ON EVERY 1 DAY fires every 24 hours from the last run; for the same clock time every calendar day, use daily ON TIMESTAMP instead.2. ON EVERY DAY AT — weekly, specific day
Fires once per week on the named weekday at the given local time. Use "HH:mm" or "HH:mm:ss"; seconds are optional.
| Keyword | Fires on |
|---|---|
MONDAY … SUNDAY | That weekday each week |
3. ON EVERY WEEKDAY AT — Monday–Friday
Fires Monday through Friday at the same local time—one action instead of five separate daily schedules.
4. ON EVERY WEEKEND AT — Saturday and Sunday
Fires on both weekend days at the specified local time—useful for maintenance windows or weekend-only reporting.
5. ON TIMESTAMP — daily fixed time
Fires every day at the given local wall-clock time. Unlike ON EVERY 1 DAY, this tracks clock time, not elapsed time since the broker or last run started.
"HH:mm" without seconds is accepted.
6. ON TIMESTAMP — one-shot, exact date and time
Fires once at the exact instant given, then never again (the scheduler moves the next run far into the future). Format is strictly dd-MM-yyyy HH:mm:ss (day–month–year). The timestamp is treated as UTC.
Combination patterns
Real systems often split schedules across several actions—one trigger per concern.Fast poll + daily summary
Fast poll + daily summary
Weekday operations + weekend maintenance
Weekday operations + weekend maintenance
Weekly reset + daily snapshot + live throughput
Weekly reset + daily snapshot + live throughput
One-shot cutover + ongoing heartbeat
One-shot cutover + ongoing heartbeat
Error handling
If a time string does not match an expected format, the broker logs an error similar to:Invalid DATE_TIME format: <value>. Expected formats:
dd-MM-yyyy HH:mm:ss(one-time)HH:mm:ss/HH:mm(daily)- Weekly forms using a day name with
ATand a time string
$SYS/Coreflux/Actions/<ActionName>/Error
Subscribe to $SYS/Coreflux/Actions/+/Error to observe failures from any action.
At a glance — valid time triggers
More examples
System heartbeat
System heartbeat
Counter with state
Counter with state
Topic-Based Triggers
UseON TOPIC to execute actions when MQTT messages arrive:
Wildcard Patterns
LoT supports MQTT wildcards for flexible topic matching:- Single-Level (+)
- Multi-Level (+/+)
The
+ wildcard matches exactly one topic level:Matches:
sensors/room1/temperature, sensors/room2/temperatureInitialization Triggers
UseON START to execute logic exactly once when the broker starts or when the action is first deployed. This is the right place to bootstrap a Unified Namespace (UNS) structure, publish retained default configurations, and log startup events.
- Runs exactly once per broker start — not on a schedule, not on a message
KEEP TOPICpublishes with the retain flag so the value is delivered to any future subscriber immediately on connection- Use it to set default configuration values and retained state that must survive restarts
- There is no
ON STOPequivalent —ON STARTis the correct place for setup logic
Callable Actions
Actions without an event trigger are callable—they execute only when explicitly invoked by other actions or via system commands.Basic Callable Action
Callable Action with Parameters
Callable actions can accept input parameters and return values:Invoking Callable Actions
- From Another Action
- Via Command Topic
Use
CALL ACTION to invoke from within another action. This is the primary way to reuse logic across your automation:Comparing Trigger Types
| Aspect | Time-Based | Topic-Based | ON START | Callable |
|---|---|---|---|---|
| Trigger | Clock interval or schedule | MQTT message | Broker startup | Manual command |
| Frequency | Interval, daily, weekly, or once | Event-driven | Once | On-demand |
| Payload Access | No | Yes (PAYLOAD) | No | Via parameters |
| Best For | Monitoring, reporting | Data processing | Initialization | Reusable utilities |
Next Steps
Operations
Learn about SET, GET, PUBLISH, and conditional logic.
Python Integration
Extend Actions with Python for complex calculations.

