Skip to content

Repository files navigation

Coreflux LoT Samples — Language of Things for MQTT

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.

What LoT is

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.

Quick path

  1. Simple Heartbeat — timer, no hardware
  2. Sensor Data Router — wildcards and topic positions
  3. Complete sensor system — action + model + rule
  4. Factory line with a PLC — Modbus + ON CHANGE + PostgreSQL
  5. 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.

Actions

Official: events · callable · Python

Routes

SQL, Modbus, OPC UA, Kafka, and the rest ship in the broker. Official index: routes overview. Full type table: DEFINE ROUTE.

Rules

Official: rules overview · syntax

DEFINE RULE · Connect admission

Syntax

LOT Syntax · TOPIC (1-based positions) · PAYLOAD · SET · KEEP · PUBLISH

Official operations: ACTION operations.

How to run a sample

  1. Start a Coreflux broker.
  2. Set any GET ENV / GET SECRET names the sample uses (PG_HOST, OVEN_PLC_IP, …).
  3. Upload the .lot file (VS Code LoT extension, or $SYS/Coreflux/Command add-action / add-route / …).
  4. Publish a test payload and subscribe to the output topics listed in the guide.

Validate

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.

Conventions that samples used to get wrong

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 …

Resources

License

Apache 2.0 — see LICENSE.

About

No description, website, or topics provided.

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages