The Notebook Workflow
LoT Notebooks provide a direct connection between your VS Code editor and the Coreflux broker. When you run a cell, your code is sent to the broker and executed immediately—no separate deployment step required.Cell Types and Execution
LoT Notebooks support three types of cells, each with different behavior:Markdown Cells
Markdown cells are for documentation only—they don’t execute. Use them to:- Explain what your code does and why
- Document configuration requirements
- Add diagrams, tables, and formatted text
- Create section headers and navigation
LoT Code Cells
LoT cells contain executable LoT (Language of Things) code. When you run a LoT cell:- The extension parses your code
- Sends it to the connected broker via MQTT
- The broker compiles and registers the definition
- You receive confirmation or error feedback
| Definition | Purpose |
|---|---|
DEFINE ACTION | Event-driven or time-based automation |
DEFINE MODEL | Structured data transformation |
DEFINE ROUTE | External system integration (databases, APIs, bridges) |
DEFINE RULE | Access control and permissions |
Python Cells
Python cells contain scripts that run inside the broker when called from LoT Actions. The broker’s Python runtime executes your functions.Execution Flow
When you click the Run button on a cell, here’s what happens:Success Response
When your code is valid and the broker accepts it:- A green checkmark appears next to the cell
- The entity (Action, Model, Route, Rule) is registered
- For Actions, execution begins immediately based on triggers
Error Response
When something goes wrong:- An error message appears below the cell
- The message includes details about what failed
- Common issues: syntax errors, missing dependencies, connection problems
Broker Communication
The extension maintains an MQTT connection to your Coreflux broker. All notebook operations use this connection:| Operation | MQTT Topic | Description |
|---|---|---|
| Deploy code | $SYS/Coreflux/Command | Send definitions to the broker |
| Receive response | $SYS/Coreflux/Command/Output | Get success/error feedback |
| List entities | $SYS/Coreflux/Actions, etc. | View registered Actions, Models, Routes |
Connection Configuration
Configure your broker connection through the Command Palette:- Press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) - Type “LoT Notebook: Change Credentials”
- Enter your broker details:
| Setting | Example |
|---|---|
| URL | mqtt://localhost:1883 or mqtts://broker.example.com:8883 |
| Username | root |
| Password | Your broker password |
The extension securely stores your credentials. You only need to configure them once per workspace.
Available Commands
Access these commands through the VS Code Command Palette (Ctrl+Shift+P):
Notebook Commands
| Command | Description |
|---|---|
| LoT Notebook: Change Credentials | Configure broker connection |
| LoT Notebook: Run All Cells | Execute all code cells in order |
| LoT Notebook: Clear All Outputs | Remove output from all cells |
Entity Management
| Command | Description |
|---|---|
| Coreflux: List Actions | View all registered Actions |
| Coreflux: List Models | View all registered Models |
| Coreflux: List Routes | View all registered Routes |
| Coreflux: Remove Entity | Delete an Action, Model, or Route |
Bulk Operations
| Command | Description |
|---|---|
| Coreflux: Deploy All | Upload all definitions from notebook |
| Coreflux: Export Definitions | Save definitions to separate files |
Working with Output
Each code cell can display output after execution:Viewing Results
- Success: Shows confirmation message with entity name
- Error: Displays error details and line numbers when available
- Logs: For debugging, check the Output panel (View > Output > LoT Notebooks)
Clearing Output
- Click the X on individual cell outputs
- Use “LoT Notebook: Clear All Outputs” command for all cells
- Outputs are not saved with the notebook file
Best Practices
Organize with Markdown
Organize with Markdown
Use markdown cells liberally to explain your code. Future you (and teammates) will appreciate the context.
One Definition Per Cell
One Definition Per Cell
Keep each Action, Model, or Route in its own cell. This makes debugging easier and allows selective execution.
Test Incrementally
Test Incrementally
Run cells one at a time when developing. This helps isolate issues and understand system behavior.
Use Descriptive Names
Use Descriptive Names
Name your Actions, Models, and Routes clearly. They appear in the broker’s entity lists and should be self-explanatory.
Troubleshooting
Cell won't run?
Cell won't run?
- Check that you’re connected to the broker (look for connection status in status bar)
- Verify your credentials are correct
- Ensure the broker is running and accessible
Python script not recognized?
Python script not recognized?
- Confirm the first line is
# Script Name: YourScriptName - Check for syntax errors in the Python code
- Ensure function names match what you’re calling from LoT
Entity not appearing after deployment?
Entity not appearing after deployment?
- Check the output for error messages
- Verify no syntax errors in your LoT code
- Use the Coreflux Entities panel to refresh the list

