Skip to main content

Overview

The Coreflux MQTT broker provides a rich set of commands that you can use to manage users, rules, models, actions, routes, and more. These commands are published to the $SYS/Coreflux/Command topic to control and configure the broker.

Why Use Broker Commands?

Instead of editing configuration files and restarting the broker, you can manage everything at runtime through MQTT messages. Add users, deploy LoT Actions, configure Routes—all without downtime.
Think of broker commands as a remote control for your broker. You send a message to a special topic, and the broker immediately responds—no SSH, no restarts, no manual file editing.

Command Format

Commands are sent to the broker via MQTT messages published to the $SYS/Coreflux/Command topic. The general format is:
For example:
Command responses are published to $SYS/Coreflux/Command/Output. Subscribe to this topic to receive feedback from your commands.

User Management Commands

Manage broker users and their credentials.

Adding a User

Create a new user with a username and password:
Example:
Response: User operator added successfully!

Removing a User

Remove an existing user from the broker:
Example:
Response: User operator removed successfully!

Changing User Password

Update a user’s password:
Example:
Response: Password for user operator changed successfully!

Changing User Settings

Modify specific settings for a user:
Response: Settings for user updated successfully!

LoT Commands

Commands for managing LoT (Language of Things) entities.

Rules

Rules define access control and permissions for the broker. See the Rules documentation for complete syntax reference.
Rules are LoT code and can also be deployed directly from a LoT Notebook by running the cell containing your rule definition.

Adding a Rule

Example — Restrict Action creation to admins:
Response: Rule 'AllowActionCreation' added successfully
Example — Control topic access:
Response: Rule 'RestrictSensorPublish' added successfully

Removing a Rule

Example:
Response: Rule 'AllowActionCreation' removed successfully

Models

Models define data structures for topic payloads.

Adding a Model

Example:
Response: Model 'TemperatureSensor' added successfully

Removing a Model

Example:
Response: Model 'TemperatureSensor' removed successfully

Removing All Models

Response: All models removed successfully
This command removes ALL models from the broker. Use with caution.

Actions

Actions define automated behaviors triggered by events or schedules.

Adding an Action

Example - Time-based Action:
Example - Topic-based Action:
Response: Action 'Heartbeat' added successfully

Removing an Action

Example:
Response: Action 'Heartbeat' removed successfully

Running an Action Manually

Trigger an action to run immediately:
Example:
Response: Action 'Heartbeat' executed successfully

Removing All Actions

Response: All actions removed successfully

Routes

Routes configure connections to external systems and data pipelines.

Adding a Route

Example - MQTT Bridge:
Response: Route 'CloudBridge' added successfully

Removing a Route

Example:
Response: Route 'CloudBridge' removed successfully

Listing All Routes

Get a list of all registered routes:
Response: List of all registered routes with their status

Getting Route Template Code

Retrieve a template for a specific route type:
Example:
Response: Template code with all available parameters for the route type

Removing All Routes

Response: All routes removed successfully

Diagnostics

Commands for troubleshooting and debugging LoT entities.

Running LoT Diagnostic

Run diagnostics on a specific entity:
Example:
Response: Diagnostic information for the specified entity

Getting Pending Status

Check the status of pending models and actions:
Response: Status of all pending models and actions

Environment & Secrets Commands

Version Requirement: Environment variable and secret commands are available from Coreflux Broker v1.9.3 and above.
Manage environment variables and encrypted secrets at runtime. Environment variables are stored in plain text in the .env file. Secrets are encrypted with AES-256-GCM and stored in secrets.json. See Environment Variables & Secrets for full details.

Setting an Environment Variable

Persists the variable to the managed .env file. Example:
Response: Environment variable 'DB_HOST' set successfully

Removing an Environment Variable

Example:
Response: Environment variable 'OLD_CONFIG' removed successfully

Listing Environment Variables

Response: List of all managed environment variables and their values

Setting a Secret

Encrypts the value with AES-256-GCM and persists it to secrets.json. Example:
Response: Secret 'DB_PASSWORD' set successfully

Removing a Secret

Example:
Response: Secret 'OLD_API_KEY' removed successfully

Listing Secrets

Response: List of secret names (values are never displayed)
Secret values are never shown in command output, logs, or any broker interface. Only secret names are listed.

Python Integration Commands

Manage Python scripts within the broker for custom data processing.

Adding a Python Script

Example:
Response: Python script 'Calculator' added successfully
Python scripts must start with # Script Name: YourScriptName to be recognized by the system. The script name is used when calling Python functions from LoT actions using the CALL PYTHON syntax.

Removing a Python Script

Example:
Response: Python script 'Calculator' removed successfully

Installing Python Packages

Install additional Python packages via pip:
Example:
Response: Package 'numpy' installed successfully

Listing Installed Packages

View all installed Python packages:
Response: List of all installed Python packages

Removing All Python Scripts

Response: All Python scripts removed successfully

System Commands

Trace Logging Commands

Trace logging allows you to capture and monitor specific log events in the Coreflux system.

Adding a Trace Log Point

Parameters: Example:
This creates a trace point that:
  • Captures logs at Information level or higher
  • Automatically expires after 3600 seconds (1 hour)
  • Only captures logs containing “sensor”
  • Publishes matching logs to logs/sensors
Response: Trace log point added successfully

Listing Trace Log Points

View all active trace points:
Response: List of all active trace log points

Removing a Trace Log Point

Remove a specific trace point by topic:
Example:
Response: Trace log point removed successfully

Removing All Trace Log Points

Response: All trace log points removed successfully

Connection Status

View the status of all database connections and their recovery patterns:
Response: Status of all database connections

Update Data

Trigger a refresh of broker data:
Response: Data refresh triggered successfully

Command Authorization

Commands are subject to authorization rules defined in the broker. Not all users may have permission to execute all commands. See the Rules documentation for information on setting up access control.
Always ensure proper access control is configured before exposing the command topic to untrusted clients.

Next Steps

LoT Actions

Learn how to create automated behaviors

LoT Models

Structure and transform your MQTT data
Last modified on May 22, 2026