Skip to main content

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.
Quick Reference: Use the sidebar to jump to specific operations.

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:
Variables exist only during action execution and are referenced using {variable_name}.
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:
For a payload like:

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.
LoT Actions can read, write, and delete environment variables and encrypted secrets at runtime. Environment variables store non-sensitive configuration (hostnames, ports, URLs). Secrets store sensitive credentials encrypted with AES-256-GCM.
Use environment variables for configuration that can safely appear in logs (hostnames, ports, feature flags). Use secrets for anything sensitive (passwords, API keys, tokens).

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 from secrets.json, decrypting it at runtime. Returns an empty string if the secret does not exist.

Examples

KEEP SECRET

Encrypts and persists a new secret to secrets.json:

DELETE SECRET

Removes a secret from secrets.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:
  1. Parentheses () - highest priority
  2. Unary negation -
  3. Multiplication *, Division /, Modulo %
  4. 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

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 payload
  • GET 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:
Cannot Use Inline JSON ObjectsPUBLISH TOPIC does not support inline JSON object literals. This will NOT work:
Why? PUBLISH TOPIC is designed for simple scalar values (strings, numbers, timestamps, variables). It doesn’t have the type system or schema validation needed for structured JSON data.Solution: For structured JSON output, use Models with PUBLISH MODEL:
Models provide type safety, schema validation, and proper JSON serialization. See Publishing Models for complete guidance.

Dynamic Topics

Build topic paths dynamically using string concatenation:

Multiple Publishes

Actions can publish to multiple topics:
Triggering Other Actions: When you publish to a topic, any action with ON TOPIC matching that path will execute. This enables chaining actions together for complex workflows.

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.
KEEP vs PUBLISH: Both write to topics, but PUBLISH sends to the MQTT bus (external clients can subscribe). KEEP stores internally for your actions to read later - like a private scratchpad that doesn’t broadcast to subscribers.

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

Use EMPTY 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

  • STRING
  • INT
  • DOUBLE
  • BOOL
  • JSON

Calling an Action

Basic Example

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


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

  1. Triggers on any message to sensors/+/data topics
  2. Extracts the sensor ID from the topic path
  3. Parses the JSON payload to get temperature value
  4. Converts Celsius to Fahrenheit using arithmetic
  5. Alerts if temperature exceeds threshold
  6. Publishes formatted data to processed topics
  7. 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.
Last modified on June 2, 2026