Uploadable LoT (Language of Things) examples for the Coreflux MQTT broker: DEFINE ACTION, DEFINE MODEL, DEFINE ROUTE, and DEFINE RULE. Use them for industrial IoT — sensors, Modbus/S7/OPC UA PLCs, PostgreSQL, Kafka, and MQTT bridges.
Version: 2.0.0 · Changelog · Official docs map
Language reference is always on /latest/ (do not pin a versioned docs URL):
Samples here are parsed with the broker AST (tools/LotValidator). If a page and the parser disagree, the parser wins.
LoT is the SQL of live MQTT data. You declare Actions, Models, Routes, and Rules. The broker compiles them when you upload. See the official introduction.
| Construct | Role | Official docs | Start here |
|---|---|---|---|
| Action | Event-driven logic | Actions overview | DEFINE ACTION · Heartbeat |
| Model | Structured MQTT / JSON | Models overview | DEFINE MODEL |
| Route | PLC, database, cloud, AI | Routes overview | DEFINE ROUTE · PostgreSQL · Modbus |
| Rule | Who may publish / subscribe / connect | Rules overview | DEFINE RULE |
Write LoT in prose. Use lot as the markdown language tag. Indent with 4 spaces. TOPIC POSITION and {topic.N} are 1-based.
- Simple Heartbeat — timer, no hardware
- Sensor Data Router — wildcards and topic positions
- Complete sensor system — action + model + rule
- Factory line with a PLC — Modbus +
ON CHANGE+ PostgreSQL - Edge to cloud — TLS MQTT bridge
.lot files next to the guides are the uploadable source. Open them in the LoT notebook extension or send them with the broker’s add-action / add-model / add-route / add-rule commands.
Official: events · callable · Python
- Topic-based — Echo · Router · Alarms
- Time-based — Heartbeat · Counter (uses
KEEPfor state) - Change-based — Skip unchanged telemetry
- Scheduled — Shift handover
- Lifecycle — Startup and sessions
- Callable — Reusable calculations
- Python — Math calculator · Python guide
SQL, Modbus, OPC UA, Kafka, and the rest ship in the broker. Official index: routes overview. Full type table: DEFINE ROUTE.
- Database — PostgreSQL (docs) · SQL family · MongoDB · OpenSearch · Files
- OT — Modbus TCP (docs) · Siemens S7 (docs) · OPC UA (docs)
- Pipeline — MQTT Bridge (docs) · Cluster · Kafka (docs) · REST · Email
- AI — LLM · Agent (docs)
Official: rules overview · syntax
DEFINE RULE · Connect admission
LOT Syntax · TOPIC (1-based positions) · PAYLOAD · SET · KEEP · PUBLISH
Official operations: ACTION operations.
- Start a Coreflux broker.
- Set any
GET ENV/GET SECRETnames the sample uses (PG_HOST,OVEN_PLC_IP, …). - Upload the
.lotfile (VS Code LoT extension, or$SYS/Coreflux/Commandadd-action / add-route / …). - Publish a test payload and subscribe to the output topics listed in the guide.
From this repository, with the broker source at ../2-Products/broker/coreflux-broker-evo (or edit the project reference):
dotnet run --project tools/LotValidator -- .Every *.lot file is tokenized and parsed. A non-zero exit means a sample does not compile.
| Mistake | Correct |
|---|---|
TOPIC POSITION 0 or 0-based docs |
1-based. For sensors/oven-7/raw, the id is position 2 |
PUBLISH then GET TOPIC for a counter |
KEEP TOPIC is retained; GET TOPIC reads retained values |
ADD MQTT_CONFIG on OpenSearch / Email / files |
Matching OPENSEARCH_CONFIG / SMTP_CONFIG / FILE_STORAGE_CONFIG + ADD EVENT |
| SQL / Kafka listed as coming soon | They ship; see DEFINE ROUTE |
WHILE, JSON.stringify, invented REPLACE(...) |
Not LoT. Use LOOP/UNTIL, Python, or REPLACE "a" WITH "b" IN … |
- Official LoT docs (latest): docs.coreflux.org/latest/lot-language/introduction
- Docs ↔ sample map: OFFICIAL-DOCS.md
- AI crawlers: llms.txt
- Community: Discord · GitHub
Apache 2.0 — see LICENSE.