The LOT Samples repository is a 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 more. This project is designed for new users of LOT, providing an easy way to learn each LOT keyword through practical examples. By exploring the examples in this repo, users can quickly understand how to use LOT keywords in real-world IoT scenarios.
For more details on LOT, visit the LOT Language of Things page.
Setting up the LOT Samples project is straightforward. The only dependencies needed are:
- Visual Studio Code with the LOT Notebook extension (LOT Language Support by Coreflux) for syntax highlighting and running LOT code.
- The Coreflux MQTT broker, which acts as the backend to execute LOT rules and models.
Installation Steps:
- Install Visual Studio Code if you haven't already.
- In VS Code, install the LOT Language Support extension (search for "LOT Language Support by Coreflux" in the Extensions marketplace).
- Obtain the Coreflux MQTT Broker from the Coreflux website and follow its setup instructions (or use any Coreflux-compatible MQTT broker instance).
- Clone this repository or download the ZIP of LOT Samples, and open the folder in VS Code.
Once you have the dependencies set up and the repository open in VS Code, you can start exploring and running the samples:
-
Browse the Samples:
The repository is organized by LOT keywords or features. Each file demonstrates a specific keyword (e.g., examples forDEFINE
,MODEL
,RULE
,ACTION
,ROUTE
,GET
,PUBLISH
, etc.). Open any sample file to view the LOT code along with inline comments explaining its functionality. -
Run a Sample:
To execute a LOT sample:- Ensure your Coreflux MQTT broker is running.
- Open the sample file in VS Code and use the LOT extension to run it:
- Right-click within the editor and select "Upload Model or Rule to MQTT Broker" (for files containing
DEFINE MODEL
orDEFINE RULE
blocks). - Enter your broker URL when prompted (for a local broker, you might use
mqtt://127.0.0.1:1883
), along with any necessary credentials.
- Right-click within the editor and select "Upload Model or Rule to MQTT Broker" (for files containing
- The extension will deploy the LOT rule/model to the broker. Test the deployed sample by publishing messages to the relevant topics or checking the broker’s logs/output.
-
Experiment:
Modify the samples or combine different LOT keywords to experiment with the language. The samples are designed as a starting point—adjust parameters and conditions to see how the behavior changes. LOT's readability allows you to quickly iterate and understand the effects of your changes.
For more in-depth information and further learning, refer to the following resources:
- Official LOT Documentation:
Find comprehensive guides and references at the Coreflux LOT Docs. - Coreflux MQTT Broker:
Learn more about the Coreflux IoT platform and access the MQTT broker at the Coreflux website. - LOT Language of Things:
Explore additional information and updates on LOT at the LOT Language of Things page.
Contributions to LOT Samples are welcome! If you have additional examples, improvements, or bug fixes, please feel free to contribute:
- Fork the repository on GitHub and create a new branch for your changes.
- Add or update samples: Follow the existing format and naming conventions when adding new examples. Provide clear comments or documentation notes with your sample.
- Submit a Pull Request: Open a pull request with a detailed description of your changes. Maintainers will review and merge contributions that align with the project’s guidelines.
- Open issues to report problems or suggest new sample ideas. Your feedback helps improve the repository for everyone.
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. Please see the LICENSE file for details.