Skip to main content

Overview

Actions are executable logic blocks that run directly inside the Coreflux MQTT broker. They react to events—incoming messages, time intervals, or manual triggers—and perform operations like data transformation, routing, and alerting.
Think of Actions like a mail sorting machine. When a letter (message) arrives, the machine reads the address (topic), decides where it should go (routing logic), and sends it to the right mailbox (publishes to a topic). All of this happens instantly, without needing a person to manually sort each letter.

Action Capabilities


When to Use Each Pattern


In This Section

Syntax Reference

Start here to learn the DEFINE ACTION structure and build your first action.

Action Triggers

Choose the right trigger type for your use case: time-based, topic-based, or callable.

Operations

Master SET, GET, PUBLISH, conditionals, and all available LoT operations.

Python Integration

Extend actions with Python when you need complex logic or external libraries.

Action Types

LoT supports three action patterns:

Time-Based Actions

Execute at regular intervals using ON EVERY:
Key characteristics:
  • Runs on a schedule regardless of incoming data
  • Useful for monitoring, polling, and periodic reports
  • Supported units: MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS, WEEKS, MONTHS, YEARS
  • Calendar-aware scheduling: ON EVERY WEEKDAY AT "HH:MM:SS" and ON EVERY WEEKEND AT "HH:MM:SS"

Topic-Based Actions

Execute when MQTT messages arrive using ON TOPIC:
Key characteristics:
  • Triggers instantly when matching messages arrive
  • Supports + (single-level) and # (multi-level) MQTT wildcards
  • Access payload data via PAYLOAD and GET JSON
  • Extract topic segments with TOPIC POSITION

Callable Actions

Actions without triggers are invoked manually or by other actions:
Key characteristics:
  • No automatic trigger—must be invoked explicitly
  • Can accept input parameters and return values
  • Invoked via $SYS/Coreflux/Command or CALL ACTION
  • Ideal for reusable utility functions
Learn more about invoking callable actions in Action Triggers.

Core Operations

Actions use these operations to process data:
SET, GET TOPIC, GET JSON, PUBLISH, and IF/THEN are the core operations for working with data in actions. See the Operations Reference for complete details.
Create and use variables within an action:

Example: Complete Sensor Processor

This example combines topic matching, JSON extraction, conditional routing, and state updates in a realistic sensor processing action.
What this does:
  1. Triggers when any message arrives at sensors/*/raw
  2. Extracts the sensor ID from the topic path
  3. Parses temperature and humidity from the JSON payload
  4. Routes alerts based on temperature thresholds
  5. Publishes processed data and timestamps

Actions vs. Models

Actions and Models serve different purposes in LoT: Use them together: Actions process and route data, then publish it using a Model to produce structured JSON output.

Next Steps

Syntax Reference

Learn the complete DEFINE ACTION syntax and components.

Action Triggers

Master time-based, topic-based, and callable triggers.
Last modified on May 22, 2026