The LOT Samples repository is a comprehensive collection of demonstrations, tutorials, and sample code for the LOT language. LOT (Language of Things) is a human-readable, domain-specific language for IoT systems that uses near-English syntax to define rules, models, actions, and routes. This project is designed for both new and experienced users of LOT, providing practical examples and patterns for real-world IoT scenarios.
Version: 1.0.0 | View Changelog
For more details on LOT, visit the LOT Language of Things page.
LOT is the SQL of real-time MQTT data. Just as SQL transforms and queries static database records, LOT transforms and processes live MQTT streams in real-time. It eliminates the need for complex middleware by embedding business logic directly into the MQTT broker.
- Actions - Event-driven logic triggered by time or topics
- Models - Data structures that format and validate MQTT data
- Routes - System integrations (bridges, databases, pipelines)
- Syntax - Language keywords and functional operators
- Python Integration - Extend LOT with Python functions
- Examples - Complete system implementations
Execute logic in response to events:
-
Topic-Based Actions - React to MQTT messages
- Simple Echo - Basic message forwarding
- Sensor Data Router - Wildcard routing
- Alarm Processor - Multi-level processing
-
Time-Based Actions - Execute on schedules
- Simple Heartbeat - Periodic signals
- Counter Action - State management
- Production Simulator - Realistic metrics
-
Python Actions - Python-integrated logic
- Math Calculator - Complex calculations
View all Actions documentation β
Define and format MQTT data:
-
Basic Models - Core data schema pattern
- DEFINE MODEL Pattern - Field types, triggers, calculations
- JSON reception and explosion
- Singleton and multi-instance patterns
-
Action Models - Dynamic publishing
- PUBLISH MODEL Pattern - Event-driven records
- GET JSON extraction with type casting
- Runtime data creation
-
Model Inheritance - Code reuse
- FROM Keyword Pattern - Model families
- Base and specialized models
- Polymorphic data handling
View all Models documentation β
Connect LOT to external systems:
- DataPipeline Routes
- MQTT Bridge - Broker-to-broker connectivity
- OpenSearch - Database storage
- Email - Email notifications
- File Storage - File operations
View all Routes documentation β
Extend LOT with Python:
- Simple Python - Core integration patterns
- CALL PYTHON syntax
- Math calculations and statistics
- Data validation
- Text processing and unit conversions
- JSON manipulation
- Error handling strategies
Real-world implementations combining multiple components:
- Sensor Data Processing System
- Topic actions for real-time processing
- Python validation and analysis
- Action models for structured records
- MQTT bridge to cloud
- OpenSearch database storage
- Time-based monitoring and statistics
Explore language keywords and operators:
-
Entities - Core LOT entities
-
Functional Keywords - Data operations
View complete syntax guide β
- Visual Studio Code - Primary development environment
- LOT Notebook Extension - LOT Language Support by Coreflux
- Provides syntax highlighting
- Enables LOT code execution
- Notebook format support (.lotnb files)
- Coreflux MQTT Broker - Runtime execution environment
- Executes LOT rules and models
- Provides MQTT infrastructure
- Available from coreflux.org
-
Install Visual Studio Code
Download from: https://code.visualstudio.com/ -
Install LOT Language Support Extension
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "LOT Language Support by Coreflux"
- Click Install
-
Set Up Coreflux MQTT Broker
- Download from Coreflux website
- Follow broker setup instructions
- Start broker service
-
Clone or Download LOT Samples
git clone https://github.com/CorefluxCommunity/LOT-Samples.git cd LOT-Samples -
Open in VS Code
code .
The repository is organized by LOT concepts and patterns:
LOT-Samples/
βββ Actions/ # Event-driven logic
βββ Models/ # Data structures
βββ Routes/ # System integrations
βββ Syntax/ # Language reference
βββ Python/ # Python integration
βββ Examples/ # Complete systems
Each folder contains:
- Main documentation (DEFINE [CONCEPT].md)
- Pattern guides (detailed explanations)
- Examples (working code samples)
Open any .md file or .lotnb file to view LOT code with inline comments.
To run a LOT sample:
- Ensure your Coreflux MQTT broker is running
- Open the sample file in VS Code
- Right-click in the editor
- Select "Upload Model or Rule to MQTT Broker"
- Enter broker URL (e.g.,
mqtt://127.0.0.1:1883) - Provide credentials if required
After deployment:
- Use MQTT client to publish test messages
- Subscribe to output topics
- Monitor broker logs
- Verify expected behavior
DEFINE ACTION SimpleHeartbeat
ON EVERY 5 SECONDS DO
PUBLISH TOPIC "system/heartbeat" WITH "alive"
- Deploy this action to your broker
- Subscribe to topic:
system/heartbeat - Observe message "alive" every 5 seconds
All documentation files include standardized metadata:
---
title: Document Title
category: Action|Model|Route|Syntax|Python|Example
version: 1.0.0
last_updated: 2025-10-25
description: One-line summary
related_tutorials: Tutorial links
---Each documentation file follows a consistent structure:
- Overview - What it does and why
- Pattern/Syntax - How to use it
- Examples - Working code
- Use Cases - Real-world applications
- Variations - Alternative approaches
- Related - Links to related docs
-
Start with Actions
- Begin with Simple Heartbeat
- Progress to Simple Echo
-
Learn Models
- Understand DEFINE MODEL Pattern
- Explore JSON reception behavior
-
Explore Routes
- Start with MQTT Bridge
-
Try Complete Example
- Master Action Models
- Learn Model Inheritance
- Integrate Python
- Build complete systems from Examples
- Optimize performance patterns
- Design scalable architectures
- Create custom Python modules
- Contribute new examples
- LOT Documentation: docs.coreflux.org/LOT/
- Coreflux Platform: coreflux.org
- LOT Language: coreflux.org/lot-language-of-things
- Discord Server: discord.com/invite/A3pPrptNMm
- GitHub Community: github.com/CorefluxCommunity
- Tutorial Materials: See
/Tutorialfolder for comprehensive training - Example Notebooks: Practical LOT notebook examples
Contributions to LOT Samples are welcome!
- Fork the repository on GitHub
- Create a feature branch for your changes
- Follow the documentation standards:
- Include metadata front-matter
- Use consistent formatting
- Provide working examples
- Add inline comments
- Test your examples with Coreflux broker
- Submit a Pull Request with detailed description
- New Examples: Follow existing patterns and naming conventions
- Documentation: Match the established format and style
- Code Quality: Test all LOT code before submitting
- Comments: Explain logic and provide context
- Metadata: Include version and category information
- Open issues for bugs, improvements, or suggestions
- Provide clear descriptions and reproduction steps
- Include LOT code snippets when relevant
- Suggest documentation improvements
Current Version: 1.0.0 (2025-10-25)
This release represents a major documentation refactoring:
- Reorganized structure based on Tutorial materials
- Improved naming conventions
- Added Python integration documentation
- Created comprehensive examples
- Standardized metadata across all files
See CHANGELOG.md for detailed version history.
This project is licensed under the Apache 2.0 License.
By using or contributing to this repository, you agree to the terms and conditions of the license. See the LICENSE file for complete details.
This documentation project aligns with and extends the comprehensive Tutorial materials developed by the Coreflux team. Special thanks to all contributors and the Coreflux community for their valuable feedback and examples.
Ready to start? Begin with Simple Heartbeat or explore the Complete Sensor System Example.
Questions? Join the Discord Community or visit Coreflux Documentation.
