Overview
Complete reference for all LoT operations available within actions. These operations allow you to manipulate variables, perform calculations, transform strings, read and write MQTT topics, and implement conditional logic.Variable Operations
SET, GET TOPIC, and GET JSON are the core operations for working with data in actions. They allow you to store values, read from MQTT topics, and extract fields from JSON payloads.
SET
Creates or assigns a value to an internal variable:{variable_name}.
- Static Value
- From Topic
- Calculated
Variable names must be enclosed in double quotes when using SET, but referenced with curly braces:
SET "myVar" WITH 10 then use {myVar}.GET TOPIC
Retrieves the last known value from a topic. If the topic has no value, the broker returns a default based on the requested type.Default Values for Missing Topics
Type Casting
Wildcard Inheritance
When an action is triggered by a wildcard topic pattern, GET TOPIC inherits the matched wildcard values:Example Usage
GET JSON
Extracts fields from JSON payloads with support for nested paths and arrays.For narrative patterns, missing-field workflows, and end-to-end
PUBLISH MODEL examples, see Working with JSON.Basic Syntax
Supported Types
Nested Path Extraction
Use dot notation to access nested objects and bracket notation for arrays:Error Handling
If a field doesn’t exist, the result depends on the requested type:
Use EMPTY check for conditional handling:
Complete Example
Environment Variables & Secrets
Version Requirement:
GET ENV, GET SECRET, KEEP ENV, KEEP SECRET, DELETE ENV, and DELETE SECRET are available from Coreflux Broker v1.9.3 and above.GET ENV
Reads an environment variable. The broker checks the managed.env file first, then falls back to process, user, and machine environment variables. Returns an empty string if not found.
Examples
KEEP ENV
Persists a new environment variable to the.env file on disk:
DELETE ENV
Removes an environment variable from the managed.env file:
GET SECRET
Reads an encrypted secret fromsecrets.json, decrypting it at runtime. Returns an empty string if the secret does not exist.
Examples
KEEP SECRET
Encrypts and persists a new secret tosecrets.json:
DELETE SECRET
Removes a secret fromsecrets.json:
Complete Example
For full details on environment variable resolution order, encryption key management, and deployment configuration, see Environment Variables & Secrets.
Arithmetic Operators
LoT supports standard arithmetic operations that work with numeric types (INT, DOUBLE) and can be combined with GET TOPIC, PAYLOAD, and variables.Supported Operators
Syntax
Basic Examples
Using with Variables
Using with GET TOPIC
Using with PAYLOAD
Operator Precedence
Operations follow standard mathematical precedence:- Parentheses
()- highest priority - Unary negation
- - Multiplication
*, Division/, Modulo% - Addition
+, Subtraction-
Complete Example
String Concatenation
The+ operator concatenates strings, allowing dynamic construction of topics, messages, and values.
Syntax
Basic Examples
Dynamic Topic Construction
Combining Strings with Other Types
Complete Example
RANDOM Function
Generates random values of various types including numeric ranges and unique identifiers.Syntax
Random Integers
Random Doubles
Unique Identifiers
Use Cases
- Simulation
- Unique IDs
- Load Balancing
Generate test data for sensors:
String Transformations
LoT provides string transformation operations for filtering, replacing, and parsing text data.FILTER
Extracts content from a string using a regular expression pattern.Syntax
Supported Sources
PAYLOAD- The incoming message payloadGET TOPIC "path"- Value from an MQTT topic{variable}- A previously set variable"string literal"- A hardcoded string
Examples
Common Regex Patterns
REPLACE
Replaces occurrences of a pattern with a new value.Syntax
Examples
Multiple Replacements
SPLIT CSV
Parses CSV (Comma-Separated Values) data from the payload into a structured format.Syntax
Parameters
Example
SPLIT CSV currently only supports PAYLOAD as input. Support for GET TOPIC and variables is planned for future releases.
Topic Operations
PUBLISH TOPIC
Sends data to an MQTT topic, broadcasting it to all clients subscribed to that topic. Published messages are delivered immediately and can trigger other actions or routes listening to the topic.Syntax
Value Types
You can publish various value types:Dynamic Topics
Build topic paths dynamically using string concatenation:Multiple Publishes
Actions can publish to multiple topics:KEEP TOPIC
Stores a value in an internal broker topic that persists between action executions. Think of KEEP as creating a persistent variable - unlike SET (which exists only during one execution), KEEP values survive and can be read later.When to Use KEEP
Syntax
Example: Persistent Counter
KEEP vs PUBLISH Comparison
Control Flow
IF … THEN … ELSE
Execute different logic based on conditions.Comparison Operators
Basic Conditionals
Nested Conditionals
For multiple conditions, nest IF statements:Checking for Empty Topics
UseEMPTY to check if a topic has no value:
Combining with Expressions
Timestamps
Add timestamps to your messages for tracking, logging, and debugging. LoT supports two timestamp formats.Supported Formats
Syntax
Using with PUBLISH and KEEP
Using with SET
Complete Example
Callable Actions
LoT supports callable actions - actions that can be invoked by other actions with input parameters and return values. This enables modular, reusable logic blocks.For reusable logic, on-demand scripts, and composition patterns, see Callable ACTIONs.
Defining a Callable Action
Supported Input Types
STRINGINTDOUBLEBOOLJSON
Calling an Action
Basic Example
- Define
- Call
Create a reusable calculation:
Multiple Outputs
Utility Action Library
Build reusable utility actions for common operations:TRIGGER Statement
The TRIGGER statement allows actions to programmatically trigger route events or mappings. This is useful for initiating data pipeline operations or triggering external integrations.Syntax
Components
Basic Examples
Complete Example
Use Cases
- Email Notifications
- Database Operations
- External APIs
CALL MCP
CALL MCP allows actions to invoke tools provided by MCP (Model Context Protocol) routes. This enables integration with AI assistants and external tools.Prerequisites
- An MCP route must be defined and active
- The route must expose the tool you want to call
Syntax
Example MCP Route
Basic Examples
Complete Example
Complete Example
This example combines the key operations covered on this page—SET, GET TOPIC, GET JSON, arithmetic, IF/THEN, PUBLISH, and KEEP—in a realistic sensor processing action.What This Action Does
- Triggers on any message to
sensors/+/datatopics - Extracts the sensor ID from the topic path
- Parses the JSON payload to get temperature value
- Converts Celsius to Fahrenheit using arithmetic
- Alerts if temperature exceeds threshold
- Publishes formatted data to processed topics
- Caches the raw payload for future reference
Quick Reference
Next Steps
Python Integration
Extend actions with Python functions for complex logic.
LoT Notebooks
Run and deploy these operations from VS Code with LoT Notebooks.

