Skip to content

LOT Notebooks for VS Code

Overview

LOT Notebooks provide an interactive, Jupyter-like development experience for the Language of Things (LOT) in Visual Studio Code. Using .lotnb files, you can create complete "System as Code" documents that combine both documentation and executable code in a single file.

Coreflux offers two complementary VS Code extensions:

  1. LOT Notebooks Extension: For creating and working with .lotnb notebook files
  2. LOT Language Support: For syntax highlighting and working with individual .lot script files

This documentation focuses primarily on the notebook experience, which is the recommended approach for creating complete IoT orchestrations with Coreflux.

What are LOT Notebooks?

LOT Notebooks (.lotnb files) are interactive documents that contain:

  • Markdown cells: For documentation, explanations, diagrams, and context
  • LOT code cells: For executable LOT definitions (Models, Rules, Actions, Routes)

Similar to Jupyter notebooks, LOT Notebooks allow you to: - Write and execute code in individual cells - See results immediately in the output area - Include rich documentation with your code - Share complete, self-documenting solutions

This "System as Code" approach combines the best of both worlds: - Documentation: Clear explanations of your system architecture and logic - Implementation: Actual code that deploys to your MQTT broker - Visualization: Charts and diagrams that illustrate your system

Installation

To get started with LOT Notebooks:

1. Install the Extensions

  1. Open Visual Studio Code
  2. Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X)
  3. Search for and install both extensions:
  4. LOT Notebooks by Coreflux
  5. LOT Language Support by Coreflux

2. Configure Your MQTT Broker

Before creating your first notebook, you'll need to configure your connection to the Coreflux MQTT broker:

  1. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
  2. Type "LOT Notebook: Change Credentials" and select it
  3. Enter your broker details:
  4. URL (e.g., mqtt://localhost:1883)
  5. Username (default is "root")
  6. Password

Changing MQTT Credentials

Changing MQTT Credentials in the LOT Notebooks extension

Using LOT Notebooks

Available Commands

The LOT Notebooks extension provides several commands to help you work with your notebooks and interact with the MQTT broker. Access these commands through the VS Code Command Palette (Ctrl+Shift+P or Cmd+Shift+P).

Command Palette

LOT Notebooks commands in the VS Code Command Palette

Uploading Models and Actions to the Broker

After writing your models or actions in LOT, you can easily upload them to the MQTT broker directly from the notebook:

  1. Create a code cell with your LOT definition (MODEL, ACTION, RULE, etc.)
  2. Execute the cell
  3. The extension will automatically upload your definition to the connected broker

Uploading a Model

Uploading a LOT model to the MQTT broker

The LOT Notebooks Documentation

For detailed information, see the following sections: