Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt

Use this file to discover all available pages before exploring further.

Coreflux HUB overview screen with a 'Start here' arrow pointing to the first navigation icon in the bottom toolbar

Why This Guide?

This is the fastest way to validate your Coreflux setup: in under 15 minutes you’ll have a live LoT (Language of Things) Action running inside your broker—proof that your installation works and logic executes at the edge. New to Coreflux? Start with the Overview.
Like installing an app on your router instead of your phone. LoT Actions run directly inside the broker — your logic executes at the edge without an external script or server.

Prerequisites

Before you begin, ensure you have:
  • A running Coreflux Broker — See the Installation Guide if you haven’t set one up yet
  • VS Code with the LoT Notebooks extension or access to the Coreflux HUB in your browser — see the VS Code Setup Guide for the extension
  • Basic MQTT knowledge — Understanding of topics, publish/subscribe patterns

Ready? Here’s what you’ll build and deploy.

Your First LoT Action in 15 Minutes

Concept Refresher: You are about to write an action that lives and runs inside the broker, not on your laptop.
Let’s create a simulated temperature sensor that publishes a temperature reading every 5 seconds. You’ll see data on a topic as soon as you deploy—no external input required. This keeps the whole guide in a single “temperature monitoring” flow.

Understanding the Action

LoT Actions have three parts:
  1. DefinitionDEFINE ACTION <name>
  2. Trigger — When to run (ON EVERY <time> or ON TOPIC "<topic>")
  3. Logic — What to do (publish data, conditional logic, etc.)
Here’s what we’re building:
Temperature Simulator
DEFINE ACTION TemperatureSimulator
ON EVERY 5 SECONDS DO
    PUBLISH TOPIC "sensors/zone1/temperature" WITH "{\"temperature\": 72}"
LineWhat it does
DEFINE ACTION TemperatureSimulatorCreates an action named “TemperatureSimulator”
ON EVERY 5 SECONDS DOSets a time-based trigger (runs every 5 seconds)
PUBLISH TOPIC ... WITH "{\"temperature\": 72}"Publishes a JSON payload with temperature in Fahrenheit (72°F)
Quotes inside strings must be escaped with backslashes (e.g. "{\"temperature\": 72}").
For a complete reference on triggers, operations, and advanced patterns, see the Actions documentation.

Deploy the Action

If you run Coreflux via Docker with the Coreflux HUB enabled, you can deploy actions directly from the browser. See Coreflux HUB Overview for full documentation.
1

Open the HUB

In your browser, open http://localhost:8080 if the broker runs on your machine, or http://<broker-ip>:8080 using the IP address of the machine where the broker is running.
2

Go to LoT Editor

In the top navigation, select LoT, then LoT Editor, and open the Actions tab. Click + New Action.
Animated walkthrough of opening the LoT Editor, selecting the Actions tab, and clicking New Action
3

Paste the Action Code

Paste the following code (no -addAction prefix needed—the HUB handles registration):
DEFINE ACTION TemperatureSimulator
ON EVERY 5 SECONDS DO
    PUBLISH TOPIC "sensors/zone1/temperature" WITH "{\"temperature\": 72}"
4

Confirm Creation

You will see a confirmation and the action will appear in the Actions list. The action is now deployed and running on the broker.

Verify It’s Running

If you deployed via the HUB, verify using the built-in Data Viewer. In the top navigation, select MQTT, then Data Viewer. In the Topic Tree, navigate to sensorszone1temperature. You should see {"temperature": 72} arriving every 5 seconds in the payload viewer.
Coreflux HUB Data Viewer with the topic tree and live payload for a sensor temperature topic
Congratulations! Your first LoT Action is live.

Example Real Scenario: Temperature Alarm

Now let’s create a reactive action that transforms sensor data and checks thresholds. This demonstrates data transformation and conditional logic—common patterns in industrial monitoring.
This action runs only when a message arrives on sensors/+/temperature. After you deploy it, you will see no output until something publishes to that topic—for example, the Temperature Simulator from the previous section (if both are running), or a manual publish from the HUB Data Viewer or any MQTT client.
Here’s what the action does each time a new temperature reading arrives:
  1. Trigger — The action fires whenever a message is published to any topic matching sensors/+/temperature (e.g. sensors/zone1/temperature).
  2. Extract — It reads the temperature value (in Fahrenheit) from the incoming JSON payload.
  3. Convert — It transforms Fahrenheit to Celsius using the standard formula: (F − 32) × 5 / 9.
  4. Decide — If the Celsius value exceeds 35 °C, it publishes an alert to alerts/high_temp. Otherwise, it publishes the normalized Celsius reading to sensors/normalized.
DEFINE ACTION TemperatureAlarm
ON TOPIC "sensors/+/temperature" DO
    SET "temp_f" WITH (GET JSON "temperature" IN PAYLOAD AS DOUBLE)
    SET "temp_c" WITH (({temp_f} - 32) * 5 / 9)
    IF {temp_c} > 35 THEN
        PUBLISH TOPIC "alerts/high_temp" WITH ("Alert: " + {temp_c} + "°C exceeds threshold")
    ELSE
        PUBLISH TOPIC "sensors/normalized" WITH {temp_c}
The {} denotes variable substitution, and expressions must be wrapped in parentheses. The + in the topic pattern is a single-level MQTT wildcard — it matches any value in that position (e.g. sensors/zone1/temperature, sensors/zone2/temperature).

Deploy and Test

Deploy this action using the same method as above (Coreflux HUB, VS Code extension, or MQTT client). Once deployed, use the steps below to verify reactive logic.

How to Test the Logic

The action subscribes to any topic matching sensors/+/temperature (e.g. sensors/zone1/temperature). It expects a JSON payload with a temperature key (Fahrenheit). It then converts to Celsius and either publishes an alert (if > 35°C) or the normalized value.
RoleTopicDescription
Inputsensors/zone1/temperaturePublish test payloads here (must match sensors/+/temperature)
Output (normal)sensors/normalizedReceives the Celsius value when temperature is at or below 35°C
Output (alert)alerts/high_tempReceives the alert message when temperature exceeds 35°C (e.g. 95°F)
Sample payloads (copy-paste):
  • Below threshold — publish to sensors/zone1/temperature:
    {"temperature": 77}
    
    Expect: a message on sensors/normalized with the Celsius value (about 25).
  • Above threshold — publish to sensors/zone1/temperature:
    {"temperature": 95}
    
    Expect: a message on alerts/high_temp with text like “Alert: 35°C exceeds threshold”.
1

Deploy the Temperature Alarm action

In LoTLoT EditorActions, create a new action or open an existing one, paste the Temperature Alarm code, and save. Confirm it appears in the Actions list.
2

Open the Data Viewer

Select MQTTData Viewer. In the Topic Tree, watch sensors/normalized and alerts/high_temp (add them to your tracked view if needed).
Coreflux HUB Data Viewer with the Publish panel on the left, Topic Tree in the center, and a tracked topic with live values on the right
3

Send test data

In the Publish panel, set the topic to sensors/zone1/temperature and paste one of the sample JSON payloads above. Click publish. If the Temperature Simulator is still running, it already publishes every 5 seconds—you will see results on sensors/normalized (72°F is below 35°C).
4

Confirm output

Select the output topic in the tree and verify the payload in the viewer (normalized value or alert text).
This confirms your broker transforms data and applies conditional logic in real time.

Clean Up (Optional)

To remove the test action:
In LoTLoT EditorActions, select the action in the list and use the delete control. Confirm deletion—the action is removed from the broker immediately.
Animated walkthrough of selecting and deleting an Action in the LoT Editor

Quick Examples

Looking for inspiration? Check out the Language of Things Training Repository for common patterns like:
  • Topic-Based Triggers: Echo messages between topics
  • State Machines: Toggle switches and conditional logic
  • Event Counters: Track and aggregate system events

Language of Things Training

Explore a collection of ready-to-use LoT Action examples and templates.

Troubleshooting

  • Verify the broker is running and you’re connected
  • Check $SYS/Coreflux/Command/Output for error messages
  • Ensure proper indentation in your LoT action (use consistent tabs or spaces)
  • Confirm the action appears in $SYS/Coreflux/Actions or in the HUB LoT Editor Actions list
  • Verify the broker hostname/IP and port are correct
  • Check that port 1883 (or 8883 for TLS) is open
  • Confirm your username and password are correct
  • If using TLS, ensure certificates are properly configured
  • Verify you’re subscribed to the exact topic (including case sensitivity)
  • Check if any Rules are blocking access to the topic
  • Use wildcards (+ or #) to debug topic hierarchies

Next Steps

Now that you have a working setup, explore the core LoT components:

Actions

React to events and publish data. Create time-based automations or respond to topic changes.

Introduction to LoT

Understand the core concepts and architecture of the Language of Things.
Last modified on May 20, 2026