Skip to main content
VS Code with a LoT notebook open showing markdown and LoT code cells, Coreflux Explorer and project tree on the left, Data Viewer below, and MQTT connection in the status bar

Overview

LoT Notebooks are living documentation: Markdown for documentation and runnable LoT code in the same file. You run LoT to deploy to the Coreflux MQTT broker, document with Markdown and use the Data Viewer to see what is happening on the broker.
Write it, run it, see the result in the broker. With LoT Notebooks and LoT VS Code Extension, document the “why,” deploy the “what,” and see the MQTT traffic and execution logic side by side with your notebook.

Before you start

  • Visual Studio Code installed
  • A Coreflux broker installed or in another machine you can reach

Install and connect

1

Install the extension

Animated walkthrough: VS Code Extensions view, search for coreflux, install Coreflux LoT, Coreflux icon appears in the Activity Bar
  1. Open VS Code.
  2. Open the Extensions view in the sidebar (or use the shortcut Ctrl+Shift+X on Windows/Linux, Cmd+Shift+X on macOS).
  3. Search for LoT Notebooks by Coreflux and install it.
2

Connect to the broker

VS Code: connect to MQTT broker via LoT extension; status bar shows MQTT connected
  1. Click on the MQTT Connection Status on bottom left corner of your VS Code or click Connect to Broker in the Data Viewer (Coreflux sidebar).
  2. Enter your broker URL, username, and password.
Use a full URL such as mqtt://localhost:1883 or mqtts://your-host:8883 for TLS.
SettingExample (local defaults)
URLmqtt://localhost:1883
Usernameroot
Passwordcoreflux (change immediately in production)
When you are connected, the status bar shows a green MQTT: Connected. If any issues occur, the status bar will become red.

Create a LoT notebook and deploy your first LoT code

LoT Notebook: Create and deploy to broker from a code cell; success feedback and Coreflux Explorer update
  1. In the Activity Bar (left bar), open Coreflux.
  2. Under PROJECT, use New File, give your LoT Notebook a name, and it will be created within the workspace folder you opened in VS Code.
  3. Add a code cell from the notebook toolbar (+ Code). Optionally, add a Markdown cell (+ Markdown) to document your code.
  4. Write or paste a LoT code (for example the Action below) and click Execute Cell icon on the cell or Run All option above.
    DEFINE ACTION Heartbeat
    ON EVERY 10 SECONDS DO
        PUBLISH TOPIC "system/heartbeat" WITH TIMESTAMP "UTC"
    
  5. See the data change in the Data Viewer, by subscribing to all topics, just like MQTT Explorer. Additionally, you can click on a data topic to see it in more detail, including a replay of the data changes.

Next Steps

How to Use a LoT Notebook in VS Code

Workflow, cells, broker connection, commands, Git, best practices, and troubleshooting.

How to Debug in LoT Extension

Data Viewer, replay, execution trace, and debug on LoT Notebooks.