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 — See the VS Code Setup Guide for installation
- MQTT Explorer (Recommended) or any other MQTT client for verification
- Basic MQTT knowledge — Understanding of topics, publish/subscribe patterns
| Setting | Value |
|---|---|
| Host | localhost or your server IP |
| Port | 1883 (unencrypted) / 8883 (TLS) |
| Username | root |
| Password | coreflux (change immediately!) |
Your First LoT Action in 5 Minutes
Concept Refresher: You are about to write a script that lives and runs inside the broker, not on your laptop.Let’s create a simple heartbeat action that publishes a UTC timestamp every 10 seconds. This is a quick way to verify your system is alive and working.
Understanding the Action
LoT Actions have three parts:- Definition —
DEFINE ACTION <name> - Trigger — When to run (
ON EVERY <time>orON TOPIC "<topic>") - Logic — What to do (publish data, conditional logic, etc.)
Heartbeat Action
| Line | What it does |
|---|---|
DEFINE ACTION Heartbeat | Creates an action named “Heartbeat” |
ON EVERY 10 SECONDS DO | Sets a time-based trigger |
PUBLISH TOPIC ... WITH TIMESTAMP "UTC" | Publishes the current UTC time |
Deploy the Action
- VS Code Extension
- MQTT Client
1
Ensure you have the LoT Notebooks extension installed
Open the extension panel, search for ‘LoT Notebooks’, and install.
2
Create a new .LOTNB file
Click on File > New File…, and create a new text file. Rename it to .lotnb.
3
Connect to Your Broker
Enter your broker credentials (host, port, username, password) and click Connect.
4
Create a New Action
Create a new code block, and change it to the LoT type.
5
Paste the Action Code
6
Deploy
Click the Run Button on that specific cell to publish the action to your broker.
7
Verify
You should see a success notification. The action now appears in your Actions list under the Coreflux Entities tab.
Verify It’s Running
- VS Code Extension
- MQTT Client
1
Verify
If the action appears in your Actions list under the Coreflux Entities tab, it should be running.
Interactive Example: The Echo Bot
Now let’s create a reactive action that responds to you. This demonstrates how Coreflux handles events instantly.Deploy and Test
- Deploy this action using the same method as above.
- Publish a message (string) to the topic
hello/coreflux(e.g., “Are you there?”). - Watch the
replytopic. You will see an immediate response generated by the broker.
Clean Up (Optional)
To remove the test action:- VS Code Extension
- MQTT Client
On the Coreflux Entities tab, right-click the desired action in your Actions list and select “Remove”.
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.
Models
Transform and enrich data between topics. Convert raw sensor data to structured JSON with units.
Rules
Control permissions and access. Define who can publish or subscribe to which topics.
Routes
Connect to external systems. Store data in databases, bridge to cloud brokers, or send email alerts.
Quick Examples
Looking for inspiration? Check out the LoT Samples 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
LoT Samples Repository
Explore a collection of ready-to-use LoT Action examples and templates.
Troubleshooting
Action not executing?
Action not executing?
- Verify the broker is running and you’re connected
- Check
$SYS/Coreflux/Command/Outputfor error messages - Ensure proper indentation in your LoT script (use consistent tabs or spaces)
- Confirm the action appears in
$SYS/Coreflux/Actions
Can't connect to the broker?
Can't connect to the broker?
- 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
Messages not appearing on subscribed topics?
Messages not appearing on subscribed topics?
- 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
Further Resources
| Resource | Description |
|---|---|
| LoT Notebooks for VS Code | Interactive notebook experience for LoT development |
| LoT Actions Reference | Full syntax, triggers, and advanced patterns |
| LoT Models Guide | Data transformation and virtual sensors |
| LoT Rules Guide | Access control and permissions |
| LoT Routes Guide | Database storage, bridging, and notifications |
| Python Integration | Native Python execution within LoT |
| LoT Samples Repository | Community examples and templates |

