Skip to main content

The .lotnb Format

LoT Notebook files use the .lotnb extension and follow a JSON-based structure compatible with VS Code’s notebook API. Each file contains an array of cells—documentation and code blocks that make up your notebook.
You don’t need to edit the JSON directly. VS Code’s notebook interface handles the structure automatically. This page is for understanding what’s happening under the hood.

File Structure

A .lotnb file is a JSON array where each element represents a cell:

Cell Properties

Each cell has three required properties:

Kind Values

Language Values


Cell Types in Detail

Markdown Cells

Markdown cells support standard Markdown syntax plus some extensions:
Supported Markdown features:
  • Headers (#, ##, ###)
  • Bold, italic, code formatting
  • Bullet and numbered lists
  • Tables
  • Code blocks (for examples, not execution)
  • Links and images

LoT Code Cells

LoT cells contain executable Language of Things definitions:
Valid LoT definitions:

Python Cells

Python cells contain scripts that run inside the broker when called from LoT:
Required format: Python scripts must start with # Script Name: YourScriptName as the first line. This header tells the broker how to register and reference the script.

Creating a New Notebook

Method 1: VS Code Interface

  1. Create a new file with .lotnb extension
  2. VS Code automatically opens it in notebook mode
  3. Use the + Code and + Markdown buttons to add cells
  4. Select cell language from the dropdown (lot, python, markdown)

Method 2: Manual Creation

Create a file with minimal JSON structure:
Save with .lotnb extension and open in VS Code.

Example: Complete Notebook

Here’s a full example showing all cell types working together:

Best Practices

Start notebooks with a title and overview. Use headers to organize sections logically.
Keep each Action, Model, Route, or Rule in its own cell. This makes debugging and selective execution easier.
Write a markdown cell explaining what the next code cell does before writing the code. This helps you think through the logic.
Follow a naming convention for your Actions, Models, and Python scripts. Example: SensorTemperatureMonitor, ProductionPartCounter.

Troubleshooting

  • Verify the file has .lotnb extension (not .lotnb.json)
  • Check that the LoT Notebooks extension is installed
  • Ensure the file contains valid JSON (use a JSON validator)
Common issues:
  • Missing commas between cells
  • Unescaped quotes in value strings (use \")
  • Unescaped newlines (use \n)
  • Missing closing brackets
Check the language property matches the content type. VS Code should auto-detect, but you can manually switch using the language selector in the cell toolbar.

Next Steps

Getting Started

Create your first LoT Action and verify your setup is working.

LoT Language Reference

Explore the complete LoT syntax for Actions, Models, Routes, and Rules.
Last modified on August 28, 2026