Skip to main content

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 with CALL 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.
Think of callable ACTIONs as functions inside the broker. Triggered ACTIONs decide when something happens; callables hold how to compute, validate, or transform—and run only when called.

When to Use Callable ACTIONs

Before splitting logic out, understand where callables fit:
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 normal DEFINE ACTION without an ON … clause. Optionally declare INPUT parameters and RETURN one or more OUTPUT values.

Supported INPUT Types

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

  • WITH argument names must match the callee’s INPUT names.
  • RETURN variables are local to the caller and receive OUTPUT values in declaration order.

Parameter Passing

Pass one or more values with WITH. Each name must match an INPUT on the callable:
Define the callable with a matching INPUT for each parameter:

Return Value Handling

The RETURN clause on the caller captures values from the callable’s OUTPUT declarations.

Single Return Value

Declare one OUTPUT on the callable and one variable on the caller:

Multiple Return Values

Declare one OUTPUT per value. On the caller, list return variables in the same order as the OUTPUT lines:
The first OUTPUT (is_above) maps to above, the second to diff, and the third to pct.

Usage Examples

Call a shared conversion from a topic-triggered ACTION instead of repeating the formula inline:

Best Practices

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.
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.
Use PascalCase, function-like names: ConvertCelsiusToFahrenheit, CalculateAverage, ValidateReading. See Naming conventions.
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.
Last modified on July 3, 2026