Overview
Most ACTIONs start automatically—on a schedule, when an MQTT message arrives, or at broker startup. A callable ACTION has no trigger. It runs only when another ACTION invokes it withCALL ACTION.
Callable ACTIONs let you extract logic into named, reusable blocks: unit conversions, threshold checks, aggregations, or short on-demand scripts (refresh a cache, recalculate totals) that run at a specific point in a workflow—not on their own timer or topic.
When to Use Callable ACTIONs
Before splitting logic out, understand where callables fit:| Use Callable ACTIONs For | Use Triggered ACTIONs For |
|---|---|
| Shared calculations used in multiple places | Reacting to MQTT messages (ON TOPIC, ON CHANGE) |
| Validations and transformations with typed inputs | Scheduled polling and reports (ON EVERY, ON TIMESTAMP) |
| On-demand steps inside a workflow (cache refresh, prep) | One-time bootstrap at startup (ON START) |
| Keeping main ACTION bodies short and readable | Logic that must run on its own when an event occurs |
If an ACTION must run by itself when data arrives or on a clock, give it a trigger. Use a callable when the logic is shared or should run only as part of another ACTION’s flow.
Defining a Callable ACTION
A callable is a normalDEFINE ACTION without an ON … clause. Optionally declare INPUT parameters and RETURN one or more OUTPUT values.
Supported INPUT Types
| Type | Typical use |
|---|---|
STRING | IDs, labels, status text |
INT | Counts, discrete setpoints |
DOUBLE | Sensor readings, analog values |
BOOL | Flags and enable/disable state |
Parameterless Callable
Use when the block has no inputs—common for on-demand scripts that read from topics or update cached state:Callable with Inputs and Return Value
CALL ACTION Syntax
WITHargument names must match the callee’sINPUTnames.RETURNvariables are local to the caller and receiveOUTPUTvalues in declaration order.
Parameter Passing
Pass one or more values withWITH. Each name must match an INPUT on the callable:
INPUT for each parameter:
Return Value Handling
TheRETURN clause on the caller captures values from the callable’s OUTPUT declarations.
Single Return Value
Declare oneOUTPUT on the callable and one variable on the caller:
Multiple Return Values
Declare oneOUTPUT per value. On the caller, list return variables in the same order as the OUTPUT lines:
OUTPUT (is_above) maps to above, the second to diff, and the third to pct.
Usage Examples
- Reusable Logic
- On-Demand Scripts
- Composing Callables
Call a shared conversion from a topic-triggered ACTION instead of repeating the formula inline:
Best Practices
One Callable, One Job
One Callable, One Job
Each callable should do one clear thing—convert units, validate a range, compute an average. If a block grows large or handles unrelated steps, split it into separate callables and compose them with
CALL ACTION.Extract Before the Third Copy
Extract Before the Third Copy
The moment the same expression appears in two ACTIONs, consider a callable. Shared rules (thresholds, conversions, KPI formulas) belong in one place so fixes propagate to every caller on deploy.
Name for Intent
Name for Intent
Use PascalCase, function-like names:
ConvertCelsiusToFahrenheit, CalculateAverage, ValidateReading. See Naming conventions.Keep Triggered ACTIONs Thin
Keep Triggered ACTIONs Thin
Triggered ACTIONs should read as workflows: read data, call utilities, publish results. Push calculations and validations into callables so topic and schedule handlers stay easy to scan and maintain.
Next Steps
Operations Reference
Review all available LoT operations.
ACTION Triggers
Time-based, topic-based, and initialization triggers.

