{"results":[{"id":"d2e50a29-ddb4-414a-b9e5-bad6b37fe092","title":"Secure UNS Access Control for Factory MQTT","short_description":"Coreflux LoT template for factory MQTT access control and probes.","content":"## How it works\n\nThis Coreflux LoT notebook implements a small factory Unified Namespace (UNS) security design. A reusable Model builds clean readings from `raw/factory/...` telemetry, an Action publishes a probe guide, and Rules enforce role-based access for `dashboard`, `device_x`, `engineer`, and `root`.\n\n## Key features\n\n- **Reusable model:** Defines `FactoryDeviceReading` for clean factory telemetry.\n- **Wildcard raw-to-clean Action:** Converts `raw/factory/+/+/temperature` into `factory/<line>/<device>/reading`.\n- **Security probe guide:** Retained topics summarize expected allow/deny behavior.\n- **Role-based Rules:** Separates raw publish, clean-tree publish, `$SYS`, and user management access.\n\n## What this template does\n\n- Maps raw temperature topics into structured clean readings.\n- Uses topic positions and retained engineering-unit metadata.\n- Publishes a retained probe tree for quick client testing.\n- Applies deny-by-default Rules with explicit role exceptions.\n\n## Prerequisites\n\n- Coreflux HUB access as `root`.\n- MQTT broker access for creating users and deploying Rules.\n- Role users: `dashboard`, `device_x`, `engineer`, and `root`.\n- Anonymous login should be disabled for production.\n\n## Setup\n\n1. Create the role users in Coreflux HUB.\n2. Deploy the Model and Actions.\n3. Deploy the Rules after confirming broker defaults.\n\n## Who is this for?\n\nFactory and OT teams who need a clear MQTT security pattern for a small UNS. It is useful for testing read/write separation, raw-device isolation, and clean-tree protection in Coreflux LoT.","difficulty":"advanced","category_id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","author_id":"27cf729c-e6e4-4c81-abcf-cdd4e15a1fa8","status":"published","is_visible":true,"is_featured":true,"view_count":162,"download_count":0,"published_at":"2026-08-28T16:47:04.444+00:00","created_at":"2026-08-28T16:44:05.373288+00:00","updated_at":"2026-08-28T16:47:03.585291+00:00","slug":"secure-uns-access-control-for-factory-mqtt","broker_version_id":"db7c468f-1f4e-4ba5-ab82-2fac63ecf379","category":{"id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","name":"Manufacturing","slug":"manufacturing"},"broker_version":{"id":"db7c468f-1f4e-4ba5-ab82-2fac63ecf379","name":"v2.14.3","slug":"v2-14-3","sort_order":1},"author":{"id":"27cf729c-e6e4-4c81-abcf-cdd4e15a1fa8","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/27cf729c-e6e4-4c81-abcf-cdd4e15a1fa8/fb513a70-b437-4732-9758-34a2494e41ad.jpg","display_name":"Gonçalo Silva","profile_slug":"27cf729ce6e44c81abcfcdd4e15a1fa8"},"tags":[{"id":"0083942f-aea5-4ca1-b853-31087cbc62bd","name":"rules","slug":"rules"},{"id":"08b8d7ee-bb55-48a1-808a-44ed9e87a8e6","name":"RBAC","slug":"rbac"},{"id":"1fdbbf03-3676-4914-8756-ff7ef4fc7476","name":"factory","slug":"factory"},{"id":"490e8d98-ca25-467d-bc61-52a3dfb6c3a8","name":"security","slug":"security"},{"id":"797899fc-ba1f-47bc-8085-9ff3891884bb","name":"retained","slug":"retained"},{"id":"ccc96708-0cca-4164-8663-42b2b20ed35c","name":"telemetry","slug":"telemetry"},{"id":"d9914328-a64d-4b38-9000-c26750a200ee","name":"mqtt","slug":"mqtt"},{"id":"df08f548-60b4-4c82-8b58-b2edaadaa03e","name":"uns","slug":"uns"}],"routes":[]},{"id":"1fa92194-49ad-4393-ae69-6c925c5b6c84","title":"How to bridge Coreflux MQTT to Kafka","short_description":"Bridge MQTT telemetry and commands to Apache Kafka for plant data pipelines.","content":"## **What this template does**\n\nBridges the Coreflux MQTT broker and an Apache Kafka cluster in both directions from a single route. Telemetry published on `plant/sensors/+/reading` is produced to the Kafka topic `plant.sensors.raw` keyed by device id, so every reading from one machine stays on one partition and keeps its order, while records arriving on `plant.commands` are consumed back onto MQTT `plant/commands/in` for the field. Credentials never appear in the LoT: the bootstrap address and consumer group are read from runtime ENV values and the SASL password from the secret store, with a PLAINTEXT profile for local clusters and a SASL_SSL profile for Confluent Cloud, Amazon MSK and Aiven. A two machine simulator publishes readings on a five second timer, so the whole path can be exercised with no hardware and no real Kafka producer.\n\n## **When to use it**\n\nUse it when MQTT edge telemetry has to reach a Kafka based analytics or data pipeline while commands, setpoints and alarms travel back to the field, and when the project needs the durable, replayable stream Kafka gives rather than the fire and forget delivery of MQTT alone.","difficulty":"intermediate","category_id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","author_id":"507e651c-7269-4e72-bf19-30eda46bba07","status":"published","is_visible":true,"is_featured":false,"view_count":250,"download_count":1,"published_at":"2026-07-29T16:20:32.458+00:00","created_at":"2026-07-29T16:16:06.193751+00:00","updated_at":"2026-07-29T16:20:31.752978+00:00","slug":"coreflux-mqtt-to-kafka-bridge","broker_version_id":"c1e30566-74f7-4aa7-8a7a-40f51265b333","category":{"id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","name":"Manufacturing","slug":"manufacturing"},"broker_version":{"id":"c1e30566-74f7-4aa7-8a7a-40f51265b333","name":"v2.0","slug":"v2-0","sort_order":4},"author":{"id":"507e651c-7269-4e72-bf19-30eda46bba07","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/507e651c-7269-4e72-bf19-30eda46bba07/3bec3115-1a9c-4a30-9228-3f33cb80354f.jpg","display_name":"Bruno Candoso","profile_slug":"bruno-candoso"},"tags":[{"id":"094275a0-dd85-4aa1-9165-607ca7a23fab","name":"Apache Kafka","slug":"apache-kafka"},{"id":"4d7e94f5-2cc5-43bf-89b2-5462dc4218b7","name":"Kafka","slug":"kafka"},{"id":"92b6a63d-ce15-464f-a75b-bee54ec2dda8","name":"AWS MSK","slug":"aws-msk"},{"id":"aed19d72-ddd6-464a-aa52-c375daaedcf7","name":"Confluent Cloud","slug":"confluent-cloud"},{"id":"c0b4777a-f141-4b25-b635-b187b475e5c5","name":"SASL_SSL","slug":"saslssl"},{"id":"ccc96708-0cca-4164-8663-42b2b20ed35c","name":"telemetry","slug":"telemetry"},{"id":"d9914328-a64d-4b38-9000-c26750a200ee","name":"mqtt","slug":"mqtt"},{"id":"f9f25c91-0edf-46de-a01c-bc31ae116193","name":"Redpanda","slug":"redpanda"}],"routes":[{"id":"c490ad65-9152-4478-9b3d-f046b845aaf7","type":"KAFKA","category":"Data Pipeline","icon_path":"59d61b95-7f5c-4e2f-a11b-56b60e744b90.png","display_name":"Kafka"}]},{"id":"e736971d-5f63-4c50-bdc1-903759f876b0","title":"Modbus RTU Energy Meter Monitoring","short_description":"Connect to a Modbus RTU Capable energy meter and alert on active power.","content":"## How it works\nThis Coreflux LoT template reads an industrial energy meter over a Modbus Serial Route, scales the registers into engineering values, and publishes them to MQTT topics. A separate LoT Action watches active power events and publishes an alarm when the configured threshold is exceeded.\n\n## Key features\n- **Modbus RTU polling:** Reads holding registers from a serial energy meter.\n- **MQTT publishing:** Maps voltage, current, power, frequency, PF, and energy counters to topics.\n- **Threshold alarm:** Raises an alert when active power goes above 3000 W.\n- **Wildcard monitoring:** Uses `energy/+/+/active_power` for multi-meter fleets.\n\n## What this template does\n- Polls `MeterReading` every 1 second.\n- Decodes and scales Modbus values into V, A, W, VA, var, Hz, PF, and kWh.\n- Publishes meter data under `energy/meter/01/...` topics.\n- Publishes `alerts/active_power` status per meter and zone.\n\n## Prerequisites\n- A Modbus RTU energy meter with documented register map.\n- Serial access to the RS485 device path.\n- Correct slave ID, baud rate, parity, data bits, and stop bits.\n\n## Setup\n1. Set the serial port and slave ID for your meter.\n2. Update register addresses, scaling, and data types to match the device manual.\n3. Confirm the MQTT topic structure for each meter.\n4. Adjust the active power threshold if needed.\n\n## Use case\nIdeal for energy monitoring in industrial sites, utility cabinets, and multi-meter deployments that need live meter telemetry plus automatic threshold alarms.","difficulty":"intermediate","category_id":"9b6b6273-bc3c-440f-b1a0-b948752bfd93","author_id":"b266f416-0a6b-42ea-927d-24d25bb1b301","status":"published","is_visible":true,"is_featured":true,"view_count":127,"download_count":0,"published_at":"2026-09-10T10:49:37.777+00:00","created_at":"2026-09-09T11:57:47.789768+00:00","updated_at":"2026-09-09T11:59:59.38328+00:00","slug":"modbus-rtu-energy-meter-monitoring","broker_version_id":"3f2908f5-ba7a-418b-9943-9b82ffd49885","category":{"id":"9b6b6273-bc3c-440f-b1a0-b948752bfd93","name":"Energy & Utilities","slug":"energy--utilities"},"broker_version":{"id":"3f2908f5-ba7a-418b-9943-9b82ffd49885","name":"v2.2","slug":"v2-2","sort_order":2},"author":{"id":"b266f416-0a6b-42ea-927d-24d25bb1b301","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/b266f416-0a6b-42ea-927d-24d25bb1b301/9054147a-ab0f-4723-b238-efd235f10b71.jpeg","display_name":"Melvin","profile_slug":"melvin"},"tags":[{"id":"077bac4d-ef9e-453e-8864-f62baf6d69ea","name":"alarms","slug":"alarms"},{"id":"18c48f44-b5bb-470c-a4ac-407571861d5d","name":"Serial","slug":"serial"},{"id":"45f048e2-129f-43b1-9319-d11a701bf9e4","name":"Energy monitoring","slug":"energy-monitoring"},{"id":"90d627dc-7b9c-4c50-acc6-77866e399806","name":"modbus","slug":"modbus"},{"id":"d14578ba-991b-4155-bf10-4cf40d10dd32","name":"RS485","slug":"rs485"},{"id":"d9914328-a64d-4b38-9000-c26750a200ee","name":"mqtt","slug":"mqtt"}],"routes":[{"id":"ec78fb08-f861-4d3e-be30-89f68ae002b3","type":"MODBUS_SERIAL","category":"Industrial","icon_path":"ec78fb08-f861-4d3e-be30-89f68ae002b3.webp","display_name":"Modbus Serial"}]},{"id":"2202d47e-bc90-4474-9e27-ae35f6545822","title":"Helsinki Tram Live Feed Geofence","short_description":"Stream tram positions from HSL MQTT into Coreflux and fire downtown enter/leave geofence events.","content":"## How it works\n\nThis Coreflux LoT notebook bridges HSL’s public MQTT feed for Helsinki trams into local topics, then validates, digests, and geofences each vehicle position. It turns a live transport stream into per-tram state plus one-off downtown enter/leave events.\n\n## Key features\n\n- **MQTT bridge:** Subscribes to `mqtt.hsl.fi` and lands tram messages under `demo/trams/feed/raw/#`.\n- **Payload gate:** Checks `VP.lat` before parsing and routes bad messages to `feed/fetch_error`.\n- **Per-vehicle digest:** Writes line, latitude, longitude, speed, speed_kmh, and heading under `demo/trams/vehicle/<veh>/`.\n- **Collapsed position model:** Publishes `TramPosition` as a single position document for map consumers.\n- **Downtown geofence:** Detects rectangular enter/leave transitions for each tram.\n\n## What this template does\n\n- Consumes the HFP v2 tram subset from HSL over MQTT.\n- Normalizes valid vehicle positions into stable vehicle topics.\n- Keeps geofence memory per vehicle with `KEEP` state.\n- Emits edge-triggered events only when a tram crosses the downtown box.\n\n## Prerequisites\n\n- Internet access to `mqtt.hsl.fi:1883`\n- Coreflux LoT support for `MQTT_BRIDGE`, actions, models, routes\n- No account required for the public broker\n\n## Setup\n\n1. Deploy `HelsinkiTramBridge` to pull `/hfp/v2/journey/ongoing/vp/tram/#` into `demo/trams/feed/raw/#`.\n2. Deploy `TramFeedGate` to filter malformed payloads.\n3. Deploy `TramDigest` to fan out vehicle topics and publish `TramPosition`.\n4. Deploy `TramGeofenceWatch` to emit `enter` and `leave` events.\n\n## Who is this for?\n\nTransit, GIS, and IoT teams that need a live Helsinki tram demo, MQTT bridge example, or a ready-made geofence pattern in Coreflux LoT.\n\n## How to customize\n\n- Change the source topic filter to widen the feed beyond trams.\n- Adjust the downtown latitude and longitude bounds for another zone.\n- Reuse the vehicle subtree pattern for additional vehicle telemetry.\n\n&nbsp;","difficulty":"intermediate","category_id":"8e1c6bcd-cc4f-4ec2-a328-fcf7e97c530a","author_id":"159fabf7-c2b0-4ed1-89b4-ad2d2c499cf2","status":"published","is_visible":true,"is_featured":false,"view_count":127,"download_count":0,"published_at":"2026-08-11T18:42:09.663+00:00","created_at":"2026-08-11T18:31:07.936658+00:00","updated_at":"2026-08-11T18:31:33.828045+00:00","slug":"helsinki-tram-live-feed-geofence","broker_version_id":"3f2908f5-ba7a-418b-9943-9b82ffd49885","category":{"id":"8e1c6bcd-cc4f-4ec2-a328-fcf7e97c530a","name":"Smart Cities","slug":"smart-cities"},"broker_version":{"id":"3f2908f5-ba7a-418b-9943-9b82ffd49885","name":"v2.2","slug":"v2-2","sort_order":2},"author":{"id":"159fabf7-c2b0-4ed1-89b4-ad2d2c499cf2","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/159fabf7-c2b0-4ed1-89b4-ad2d2c499cf2/32fd8311-1ffc-4b91-9457-8f850f7a32ed.jpg","display_name":"Dylan DuFresne","profile_slug":"dylan-dufresne"},"tags":[{"id":"07558bf0-66d5-40c9-a30f-1e4e98911590","name":"live data","slug":"live-data"},{"id":"177ba4bc-3d4b-461c-b8dd-3e04f1a35b6b","name":"HSL","slug":"hsl"},{"id":"5887f4b0-de15-4653-add1-fa27eae79ccb","name":"transit","slug":"transit"},{"id":"9e87c034-8564-41b2-93de-a1087983d59d","name":"MQTT bridge","slug":"mqtt-bridge"},{"id":"a33b7e16-c9df-4c35-8f6e-2268e5f67759","name":"GIS","slug":"gis"},{"id":"ac854ea7-5302-4fc9-bb6c-1a5faca8eec1","name":"geofence","slug":"geofence"},{"id":"d9914328-a64d-4b38-9000-c26750a200ee","name":"mqtt","slug":"mqtt"}],"routes":[{"id":"177d41b6-4860-4b00-bd53-1b0b63f19781","type":"MQTT_BRIDGE","category":"Data Pipeline","icon_path":"177d41b6-4860-4b00-bd53-1b0b63f19781.png","display_name":"MQTT Bridge"}]},{"id":"aba2b36b-48da-40cb-ab82-b652fcabbe8d","title":"Discord announcements from MQTT","short_description":"Post text from an MQTT topic to a Discord channel via a REST_API route and a LoT action.","content":"## How it works\n\n&nbsp;\n\nPublish a string to `discord/announce` (or `{\"content\":\"...\"}` to `discord/announce/json`) and the broker posts it to a Discord channel through the Discord REST API v10. A small `REST_API` route owns the HTTPS call; the `DiscordAnnounce` action wraps your text with the bot token and channel id placeholders.\n\n&nbsp;\n\n## Key features\n\n&nbsp;\n\n- **One MQTT topic → one Discord message:** plain text on `discord/announce`.\n\n- **Structured option:** JSON `{\"content\":\"...\"}` on `discord/announce/json`.\n\n- **Empty-message guard:** blank payloads are skipped and reported on `discord/announce/status`.\n\n- **Secrets out of git:** replace `<DISCORD_BOT_TOKEN>` and `<CHANNEL_ID>`, or switch to Hub `GET SECRET` / `GET ENV`.\n\n- **Correct API base:** `BASE_ADDRESS` is `https://discord.com/api/v10` with no trailing slash.\n\n&nbsp;\n\n## Prerequisites\n\n&nbsp;\n\n- Discord bot with **Send Messages**, invited to the server.\n\n- Coreflux broker licence that includes **REST_API** routes.\n\n- Outbound HTTPS to `discord.com`.\n\n&nbsp;\n\n## Setup\n\n&nbsp;\n\n1. Replace the two placeholders in the action cells.\n\n2. Deploy the route, then the actions.\n\n3. `mosquitto_pub … -t discord/announce -m 'Hello from Coreflux'`.\n\n&nbsp;\n\n## Who is this for?\n\n&nbsp;\n\nTeams who want plant or product announcements, alarm notices, or release notes mirrored into Discord without a sidecar bot process.","difficulty":"beginner","category_id":"e18d0cf5-a30f-4543-a1e0-f8fb2017198c","author_id":"72c1f666-e2e6-4bc8-9cf2-9408f3402e7e","status":"published","is_visible":true,"is_featured":false,"view_count":0,"download_count":0,"published_at":"2026-11-09T11:49:46.839+00:00","created_at":"2026-11-09T11:43:41.168294+00:00","updated_at":"2026-11-09T11:44:19.637306+00:00","slug":"discord-announcements-from-mqtt","broker_version_id":"db7c468f-1f4e-4ba5-ab82-2fac63ecf379","category":{"id":"e18d0cf5-a30f-4543-a1e0-f8fb2017198c","name":"General","slug":"general"},"broker_version":{"id":"db7c468f-1f4e-4ba5-ab82-2fac63ecf379","name":"v2.14.3","slug":"v2-14-3","sort_order":1},"author":{"id":"72c1f666-e2e6-4bc8-9cf2-9408f3402e7e","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/72c1f666-e2e6-4bc8-9cf2-9408f3402e7e/8339ae55-616e-463e-b75b-134041d2ee2b.png","display_name":"Hugo Vaz","profile_slug":"hugo-vaz"},"tags":[{"id":"3605c3ba-c0ae-4ea3-9425-54b404c0aaec","name":"messaging","slug":"messaging"},{"id":"3be6d89d-82eb-45ac-8c66-eda89ba6918d","name":"rest-api","slug":"rest-api"},{"id":"4ec812d3-339e-4c39-84e0-5ae62c9653ed","name":"routes","slug":"routes"},{"id":"822fc05a-6d8d-40f4-8210-0e00d75d41aa","name":"notifications","slug":"notifications"},{"id":"d9914328-a64d-4b38-9000-c26750a200ee","name":"mqtt","slug":"mqtt"},{"id":"f4e82da8-5861-4c87-ae43-9def5ae1c208","name":"discord","slug":"discord"},{"id":"f745645b-baa2-4bba-b60d-da511f5f700e","name":"actions","slug":"actions"}],"routes":[{"id":"e51b46bf-ebde-4f62-ba30-e561b37eed33","type":"REST_API","category":"REST API","icon_path":"e51b46bf-ebde-4f62-ba30-e561b37eed33.svg","display_name":"REST API"}]},{"id":"73ea5fef-f8a0-4512-9531-9bf6f2c38843","title":"REST API to PostgreSQL Task Board","short_description":"Coreflux LoT tutorial app for CRUD tasks, MQTT events, and PostgreSQL KPIs.","content":"## How it works\nThis LoT Notebook turns a task tracker into a broker-first flow on Coreflux LoT. A REST_API route accepts create, complete, remove, and refresh requests, while a POSTGRESQL route writes and reads task data and publishes results to MQTT topics.\n\n## Key features\n- **HTTP ingress:** `/tasks` and mutation endpoints accept REST requests in server mode.\n- **PostgreSQL persistence:** inserts, updates, deletes, and SELECT views run through a database route.\n- **MQTT egress:** task lists, due-today views, KPIs, and domain events land on `demo/tasks/#` topics.\n- **Daily reporting:** weekday triggers compose into a midnight report on `demo/tasks/reports/daily`.\n- **Topic-backed metrics:** created, completed, removed, and error counters are kept on domain topics.\n\n## Prerequisites\n- PostgreSQL reachable from the broker\n- `TASKS_DB_HOST`, `TASKS_DB_NAME`, `TASKS_DB_USER`\n- `TASKS_DB_PASSWORD` stored as a secret\n- A free server port for the REST_API route\n\n## Setup\n1. Create the `tasks` table shown in the notebook.\n2. Set the broker environment variables and secret.\n3. Deploy the `TaskBoardAPI` and `TaskBoardDB` routes, then the models and actions.\n4. Watch `demo/tasks/#` to verify CRUD results, events, metrics, and daily rollups.\n\n## What this template does\n- Publishes `TaskCreated`, `TaskCompleted`, and `TaskRemoved` models as domain events.\n- Republishes `intake/refresh` after each mutation so SELECT views update without polling.\n- Uses `PUBLISH` plus `KEEP` for state topics so both live subscribers and later `GET TOPIC` reads work.\n- Mirrors PostgreSQL status errors into `demo/tasks/metrics/errors_total`.\n\n## Who is this for?\nTeams building an internal task tracker, a CRUD demo, or a Coreflux LoT reference app for REST-to-MQTT data flow with PostgreSQL-backed reporting.","difficulty":"intermediate","category_id":"e18d0cf5-a30f-4543-a1e0-f8fb2017198c","author_id":"159fabf7-c2b0-4ed1-89b4-ad2d2c499cf2","status":"published","is_visible":true,"is_featured":false,"view_count":199,"download_count":0,"published_at":"2026-08-12T13:15:37.94+00:00","created_at":"2026-08-11T18:42:54.91828+00:00","updated_at":"2026-08-13T15:21:56.502516+00:00","slug":"rest-api-to-postgresql-task-board","broker_version_id":"3f2908f5-ba7a-418b-9943-9b82ffd49885","category":{"id":"e18d0cf5-a30f-4543-a1e0-f8fb2017198c","name":"General","slug":"general"},"broker_version":{"id":"3f2908f5-ba7a-418b-9943-9b82ffd49885","name":"v2.2","slug":"v2-2","sort_order":2},"author":{"id":"159fabf7-c2b0-4ed1-89b4-ad2d2c499cf2","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/159fabf7-c2b0-4ed1-89b4-ad2d2c499cf2/32fd8311-1ffc-4b91-9457-8f850f7a32ed.jpg","display_name":"Dylan DuFresne","profile_slug":"dylan-dufresne"},"tags":[{"id":"3089e499-23cc-4a09-8e3f-e2c38b129497","name":"topics","slug":"topics"},{"id":"3be6d89d-82eb-45ac-8c66-eda89ba6918d","name":"rest-api","slug":"rest-api"},{"id":"44813810-41e2-440a-a477-4ea86a127ac1","name":"metrics","slug":"metrics"},{"id":"5bfc34e4-8bdb-4291-9056-d371861b0198","name":"CRUD","slug":"crud"},{"id":"d72621cb-eff9-439a-9fa3-3ba4b853d441","name":"Database","slug":"database"},{"id":"d9914328-a64d-4b38-9000-c26750a200ee","name":"mqtt","slug":"mqtt"},{"id":"e0901467-0c8c-424d-9340-9553518caf0b","name":"scheduled report","slug":"scheduled-report"},{"id":"f6c3c2a2-25ff-494a-9b56-12b95fa01631","name":"postgresql","slug":"postgresql"}],"routes":[{"id":"3fb2e0db-878f-45b8-99d4-bfb066077854","type":"POSTGRESQL","category":"Data Storage","icon_path":"3fb2e0db-878f-45b8-99d4-bfb066077854.svg","display_name":"PostgreSQL"},{"id":"e51b46bf-ebde-4f62-ba30-e561b37eed33","type":"REST_API","category":"REST API","icon_path":"e51b46bf-ebde-4f62-ba30-e561b37eed33.svg","display_name":"REST API"}]},{"id":"0e72e1d3-c71b-49d8-9322-d40c104f5e6a","title":"Edge to Cloud Broker Bridge","short_description":"Federate an edge Coreflux broker to a cloud broker with an MQTT Bridge Route.","content":"This template shows you how to connect an edge broker to a cloud broker, so data from local devices can flow securely up to the cloud. It comes with three ready-to-use notebooks: one sets up the core solution (turning raw machine data into clean, organized topics, adding a high-temperature alert, and bridging everything to the cloud with proper access rules), one lets you simulate machine data for testing without any real hardware, and one provides a secure, TLS-encrypted version for production use.\n\nIt's built to be safe and easy to follow, with a clear step-by-step order so nothing breaks or gets misconfigured along the way. You can test the whole setup risk-free using the simulator, then switch to the production version when you're ready to go live with real devices and a real cloud connection. It's a great fit for anyone managing multi-site IoT setups who wants a secure, well-organized way to link edge and cloud systems.","difficulty":"intermediate","category_id":"e18d0cf5-a30f-4543-a1e0-f8fb2017198c","author_id":"27cf729c-e6e4-4c81-abcf-cdd4e15a1fa8","status":"published","is_visible":true,"is_featured":false,"view_count":280,"download_count":0,"published_at":"2026-07-29T13:53:39.842+00:00","created_at":"2026-07-29T13:53:13.135538+00:00","updated_at":"2026-08-14T09:23:57.212539+00:00","slug":"edge-to-cloud-broker-bridge","broker_version_id":"3f2908f5-ba7a-418b-9943-9b82ffd49885","category":{"id":"e18d0cf5-a30f-4543-a1e0-f8fb2017198c","name":"General","slug":"general"},"broker_version":{"id":"3f2908f5-ba7a-418b-9943-9b82ffd49885","name":"v2.2","slug":"v2-2","sort_order":2},"author":{"id":"27cf729c-e6e4-4c81-abcf-cdd4e15a1fa8","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/27cf729c-e6e4-4c81-abcf-cdd4e15a1fa8/fb513a70-b437-4732-9758-34a2494e41ad.jpg","display_name":"Gonçalo Silva","profile_slug":"27cf729ce6e44c81abcfcdd4e15a1fa8"},"tags":[{"id":"416c8216-2d24-4716-a2d4-fae6179af499","name":"cloud","slug":"cloud"},{"id":"7f4e66d9-c31e-4764-b3ea-4cda37b2e29f","name":"bridge","slug":"bridge"},{"id":"d77e98e6-2fab-4e37-829f-9bb79c3893cc","name":"edge","slug":"edge"},{"id":"d9914328-a64d-4b38-9000-c26750a200ee","name":"mqtt","slug":"mqtt"}],"routes":[{"id":"177d41b6-4860-4b00-bd53-1b0b63f19781","type":"MQTT_BRIDGE","category":"Data Pipeline","icon_path":"177d41b6-4860-4b00-bd53-1b0b63f19781.png","display_name":"MQTT Bridge"}]},{"id":"afc5fb6e-c466-46df-badc-7768e0f13dcc","title":"Agent on a Leash: AI Plant Copilot","short_description":"An LLM suggests setpoint changes but never gets write access; a named human approves every proposal.","content":"## How it works\n\nThis Coreflux LoT template lets a language model suggest setpoint changes for a curing oven without ever giving it write access. When the reject rate climbs, the broker sends the model the oven's numbers over a `REST_API` route. The answer is checked against a setpoint band and a largest allowed step, then waits on an approval queue topic until the named approver approves or rejects it. Only an approved proposal becomes a write to `cmd/setpoint`. It runs on the free Community licence.\n\n## Key features\n\n- Works with any OpenAI-compatible chat completions API, including a local Ollama. The API key stays in the broker's secret store and is never in a topic.\n- A mock model answers in the same format, so the whole flow runs with no key and no internet.\n- Proposals outside the band, or with too big a step, are blocked and logged without reaching anyone.\n- Decisions are accepted only from the MQTT user you name, and only for the proposal that is waiting.\n- Every question, proposal, decision, connect and subscribe is written to `audit/copilot/line-2/`.\n- It uses 12 of the 24 LoT artifacts and 1 of the 3 routes the Community licence allows.\n\n## Prerequisites\n\n- Coreflux broker 2.14.3 or newer. The free Community licence is enough.\n- No hardware: a simulated oven runs a few degrees hot so the copilot has something to fix.\n- A broker user for the approver, named in ENV `COPILOT_APPROVER`.\n- For a real model, an OpenAI-compatible endpoint, ENV `LLM_MODEL` and the secret `LLM_API_KEY`.\n\n## Setup\n\n1. Add the approver user and set `COPILOT_APPROVER`.\n2. Run the Models, the Actions and the simulator cells.\n3. Subscribe to `factory/hall-a/line-2/#` and `audit/copilot/#`. A proposal arrives within about a minute.\n4. Connected as the approver, publish `{\"proposal_id\":\"<id>\",\"decision\":\"approve\"}` to `factory/hall-a/line-2/oven1/copilot/decision`.\n5. To use a real model, set the endpoint, model and key, run the route and publish `llm` with retain to `config/copilot/line-2/mode`.\n6. The Rules appendix at the end needs a Growth or Enterprise licence. On Community, skip it.\n\n## What this template does\n\n- Asks the model for a new setpoint when rejects are above 2 % and nothing is waiting.\n- Publishes checked proposals to `.../copilot/proposals/pending` and blocked ones to `.../copilot/proposals/blocked`.\n- Writes the setpoint only after an approval from the named approver.\n- On a paid licence, the optional Rules stop anyone but the broker and `root` from publishing commands directly.\n\n## How to customize\n\n- Change the band, the step and the reject threshold for your process.\n- Rewrite the system prompt in `CopilotAsk` for your machine, keeping the JSON answer format.\n- Point `BASE_ADDRESS` at your own model server.\n- Add assets by publishing their `raw/` topics. The Models and Actions already use wildcards.\n\n&nbsp;\n\n&nbsp;","difficulty":"intermediate","category_id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","author_id":"507e651c-7269-4e72-bf19-30eda46bba07","status":"published","is_visible":true,"is_featured":false,"view_count":9,"download_count":0,"published_at":"2026-10-14T10:48:45.561+00:00","created_at":"2026-10-14T10:48:44.728899+00:00","updated_at":"2026-10-14T10:48:44.820945+00:00","slug":"agent-on-a-leash-ai-plant-copilot","broker_version_id":"db7c468f-1f4e-4ba5-ab82-2fac63ecf379","category":{"id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","name":"Manufacturing","slug":"manufacturing"},"broker_version":{"id":"db7c468f-1f4e-4ba5-ab82-2fac63ecf379","name":"v2.14.3","slug":"v2-14-3","sort_order":1},"author":{"id":"507e651c-7269-4e72-bf19-30eda46bba07","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/507e651c-7269-4e72-bf19-30eda46bba07/3bec3115-1a9c-4a30-9228-3f33cb80354f.jpg","display_name":"Bruno Candoso","profile_slug":"bruno-candoso"},"tags":[],"routes":[{"id":"e51b46bf-ebde-4f62-ba30-e561b37eed33","type":"REST_API","category":"REST API","icon_path":"e51b46bf-ebde-4f62-ba30-e561b37eed33.svg","display_name":"REST API"}]},{"id":"72c36026-c941-4e73-a635-ba746b5a5b5e","title":"How to connect Modbus TCP","short_description":"Poll Modbus TCP registers and publish tag values to MQTT topics for apps and dashboards.","content":"## **What this template does**\n\nEnables MQTT integration for Modbus TCP devices. By periodically polling selected registers, it extracts equipment data and publishes each mapped value to a dedicated MQTT topic. It operates flexibly, handling multiple data types (like `FLOAT`, `UINT16`), adjusting for custom endianness, and includes a built-in simulation mode for hardware-free testing.\n\n## **When to use it**\n\nIdeal for setups requiring reliable, automated data extraction from PLCs, RTUs, drives, or sensors, translating industrial Modbus data into an MQTT ecosystem.","difficulty":"intermediate","category_id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","author_id":"507e651c-7269-4e72-bf19-30eda46bba07","status":"published","is_visible":true,"is_featured":false,"view_count":421,"download_count":1,"published_at":"2026-05-16T19:44:58.687+00:00","created_at":"2026-05-16T19:44:37.462359+00:00","updated_at":"2026-05-21T21:39:55.207943+00:00","slug":"modbus-tcp-device-polling-template","broker_version_id":"c1e30566-74f7-4aa7-8a7a-40f51265b333","category":{"id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","name":"Manufacturing","slug":"manufacturing"},"broker_version":{"id":"c1e30566-74f7-4aa7-8a7a-40f51265b333","name":"v2.0","slug":"v2-0","sort_order":4},"author":{"id":"507e651c-7269-4e72-bf19-30eda46bba07","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/507e651c-7269-4e72-bf19-30eda46bba07/3bec3115-1a9c-4a30-9228-3f33cb80354f.jpg","display_name":"Bruno Candoso","profile_slug":"bruno-candoso"},"tags":[{"id":"00d1a016-71e9-428d-a835-c3f35f884d63","name":"Modbus TCP","slug":"modbus-tcp"},{"id":"4851c3ef-4668-412a-ad23-ae79be99dba9","name":"polling","slug":"polling"},{"id":"8aea2b85-76eb-45e4-806f-733d65e36b47","name":"industrial","slug":"industrial"},{"id":"a0750586-469e-492b-a762-764aea3d15d6","name":"PLC","slug":"plc"},{"id":"a15e60aa-a198-4148-b878-3cfb92ab57ac","name":"register mapping","slug":"register-mapping"},{"id":"d9914328-a64d-4b38-9000-c26750a200ee","name":"mqtt","slug":"mqtt"},{"id":"f170a03a-dbe3-4c66-93e5-0766bf9b448c","name":"simulation","slug":"simulation"}],"routes":[{"id":"0c2413e6-5db8-4aff-8678-bff862b2e86e","type":"MODBUS_TCP","category":"Industrial","icon_path":"0c2413e6-5db8-4aff-8678-bff862b2e86e.webp","display_name":"Modbus TCP"}]},{"id":"55570283-1bd0-451d-a838-bfcaa015681e","title":"How to connect to Siemens S7 PLC","short_description":"Poll Siemens S7 PLC tags and publish them to MQTT topics, with an optional value simulator.","content":"## What this template does\n\nEnables MQTT integration for Siemens S7 PLCs using the native S7 protocol. By periodically polling selected DB, marker, or I/O addresses, it extracts equipment data and publishes each value to a dedicated MQTT topic. It operates flexibly, handling multiple data types (like `REAL`, `INT`, and `BOOL`), and includes a built-in simulation mode for hardware-free testing.\n\n## **When to use it**\n\nIdeal for setups requiring direct, automated data extraction from Siemens PLCs to feed dashboards, logic rules, or downstream actions within an MQTT-based ecosystem.","difficulty":"intermediate","category_id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","author_id":"507e651c-7269-4e72-bf19-30eda46bba07","status":"published","is_visible":true,"is_featured":false,"view_count":396,"download_count":1,"published_at":"2026-05-16T19:44:18.676+00:00","created_at":"2026-05-16T19:43:58.065564+00:00","updated_at":"2026-05-21T21:42:22.353102+00:00","slug":"siemens-s7-plc-to-mqtt-template","broker_version_id":"c1e30566-74f7-4aa7-8a7a-40f51265b333","category":{"id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","name":"Manufacturing","slug":"manufacturing"},"broker_version":{"id":"c1e30566-74f7-4aa7-8a7a-40f51265b333","name":"v2.0","slug":"v2-0","sort_order":4},"author":{"id":"507e651c-7269-4e72-bf19-30eda46bba07","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/507e651c-7269-4e72-bf19-30eda46bba07/3bec3115-1a9c-4a30-9228-3f33cb80354f.jpg","display_name":"Bruno Candoso","profile_slug":"bruno-candoso"},"tags":[{"id":"2e33c5a1-fe0d-4840-9a16-645b3e63450c","name":"tags","slug":"tags"},{"id":"302f809b-e64b-4139-a7a9-c4a476a768c7","name":"siemens-s7","slug":"siemens-s7"},{"id":"4851c3ef-4668-412a-ad23-ae79be99dba9","name":"polling","slug":"polling"},{"id":"84c0f563-b75e-417b-a3e4-f8f4d4260b17","name":"dashboard","slug":"dashboard"},{"id":"a0750586-469e-492b-a762-764aea3d15d6","name":"PLC","slug":"plc"},{"id":"b2fa0172-677b-4aa4-b2e6-eb675efb7d84","name":"ISO-on-TCP","slug":"iso-on-tcp"},{"id":"d9914328-a64d-4b38-9000-c26750a200ee","name":"mqtt","slug":"mqtt"},{"id":"f170a03a-dbe3-4c66-93e5-0766bf9b448c","name":"simulation","slug":"simulation"}],"routes":[{"id":"785ac3c7-55de-4ef6-ba88-04665f66562d","type":"SIEMENS_S7","category":"Industrial","icon_path":"785ac3c7-55de-4ef6-ba88-04665f66562d.svg","display_name":"Siemens S7"}]},{"id":"367cd02b-2cc5-49bd-98f7-6ef60ad75685","title":"BESS Guardian: battery health and thermal alarms","short_description":"Turn BMS Modbus readings into a clean battery UNS with SoC and thermal-spread alarms.","content":"## How it works\n\nThis Coreflux LoT template reads battery management system data over Modbus TCP, lands it under `raw/bess/<container>/...`, and maps it into one clean record per container at `plant/bess/<container>/telemetry`. It adds cell temperature spread and a charging, discharging or idle state, then raises latched alarms when a container runs too hot on one side or leaves its safe state of charge band. It runs on the free Community licence.\n\n## Key features\n\n- The `MODBUS_TCP` route marks every tag non-writable, so nothing writes back to the battery.\n- The `BessTelemetry  Model turns SoC, min and max cell temperature, current and power into one JSON record per container.\n- `BessDerive` publishes `derived/temp_spread`, `derived/state` and `derived/record`.\n- Thermal spread raises above 8 °C and clears below 5 °C. SoC alarms raise outside 10 to 95 % and clear at 15 and 90 %.\n- An optional `POSTGRESQL` route stores every derived record in TimescaleDB, with Grafana in the included compose file.\n- The core path uses 8 of the 24 LoT artifacts and 2 of the 3 routes the Community licence allows.\n\n## Prerequisites\n\n- Coreflux broker 2.14.3 or newer. The free Community licence is enough.\n- No hardware: the two-container simulator drives every alarm.\n- For real data, a BMS that speaks Modbus TCP, with its host in ENV `BESS_BMS_HOST`.\n- For the historian, Docker and the secret `BESS_DB_PASSWORD`.\n\n## Setup\n\n1. Run the Models, then the Actions.\n2. Run the simulator cells for the hardware-free demo.\n3. Subscribe to `plant/bess/#` and `alerts/bess/#`. Both alarm types raise and clear within about 4 minutes.\n4. Run the Routes only when a real BMS or database is reachable.\n5. The Rules appendix at the end needs a Growth or Enterprise licence. On Community, skip it.\n\n## What this template does\n\n- Publishes one telemetry record per container at `plant/bess/<container>/telemetry`.\n- Raises and clears `alerts/bess/<container>/thermal_spread` and `alerts/bess/<container>/soc_band`.\n- Stores derived records in a TimescaleDB hypertable when the historian route is on.\n- On a paid licence, the optional Rules make the battery and alarm topics read-only for everyone but `root` and the broker itself.\n\n## How to customize\n\n- Change the `plant/bess/` topic prefix for your site.\n- Edit the Modbus register map to match your BMS vendor.\n- Tune the thermal spread and SoC thresholds in the alarm Actions.\n- Add a container by copying the route and pointing it at the next BMS. On Community that uses your third and last route.\n\n&nbsp;\n\n&nbsp;","difficulty":"intermediate","category_id":"9b6b6273-bc3c-440f-b1a0-b948752bfd93","author_id":"507e651c-7269-4e72-bf19-30eda46bba07","status":"published","is_visible":true,"is_featured":false,"view_count":16,"download_count":0,"published_at":"2026-10-14T09:32:27.488+00:00","created_at":"2026-10-14T09:32:26.255709+00:00","updated_at":"2026-10-14T10:47:28.07762+00:00","slug":"bess-guardian-battery-health-and-thermal-alarms","broker_version_id":"db7c468f-1f4e-4ba5-ab82-2fac63ecf379","category":{"id":"9b6b6273-bc3c-440f-b1a0-b948752bfd93","name":"Energy & Utilities","slug":"energy--utilities"},"broker_version":{"id":"db7c468f-1f4e-4ba5-ab82-2fac63ecf379","name":"v2.14.3","slug":"v2-14-3","sort_order":1},"author":{"id":"507e651c-7269-4e72-bf19-30eda46bba07","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/507e651c-7269-4e72-bf19-30eda46bba07/3bec3115-1a9c-4a30-9228-3f33cb80354f.jpg","display_name":"Bruno Candoso","profile_slug":"bruno-candoso"},"tags":[{"id":"077bac4d-ef9e-453e-8864-f62baf6d69ea","name":"alarms","slug":"alarms"},{"id":"48ea76f1-12ea-4df7-8190-89a2429e223d","name":"timescaledb","slug":"timescaledb"},{"id":"4f28dc65-1fd4-4b6d-bb06-a24342903fc4","name":"energy-storage","slug":"energy-storage"},{"id":"6c72972c-3794-4300-b752-a60a16aa9d71","name":"battery","slug":"battery"},{"id":"7a95bcaf-5729-4949-84d0-4ada9a204b70","name":"grafana","slug":"grafana"},{"id":"90d627dc-7b9c-4c50-acc6-77866e399806","name":"modbus","slug":"modbus"},{"id":"a8c820e0-b3fb-4fa8-913a-470abcb17e76","name":"BESS","slug":"bess"},{"id":"df08f548-60b4-4c82-8b58-b2edaadaa03e","name":"uns","slug":"uns"}],"routes":[{"id":"0c2413e6-5db8-4aff-8678-bff862b2e86e","type":"MODBUS_TCP","category":"Industrial","icon_path":"0c2413e6-5db8-4aff-8678-bff862b2e86e.webp","display_name":"Modbus TCP"},{"id":"3fb2e0db-878f-45b8-99d4-bfb066077854","type":"POSTGRESQL","category":"Data Storage","icon_path":"3fb2e0db-878f-45b8-99d4-bfb066077854.svg","display_name":"PostgreSQL"}]},{"id":"10457569-8320-41ca-a40e-d691c4856c95","title":"How to Hook Telegram Alerts via REST","short_description":"Send MQTT text to Telegram chats via the Bot API for alerts and status messages","content":"## What this template does\n\nEnables seamless MQTT to Telegram alerting. By translating plain text published on a trigger topic, it automatically formats and delivers messages to the Telegram Bot API via REST POST requests. It operates securely by utilizing runtime secrets for bot credentials, locking down internal delivery topics, and includes an optional heartbeat timer for easy, trigger-free simulation and testing.\n\n### When to use it\n\nIdeal for setups requiring real-time, automated notifications, seamlessly bridging local MQTT system events, alarms, or status updates directly into human readable Telegram chats and groups.\n\n&nbsp;","difficulty":"beginner","category_id":"e18d0cf5-a30f-4543-a1e0-f8fb2017198c","author_id":"507e651c-7269-4e72-bf19-30eda46bba07","status":"published","is_visible":true,"is_featured":false,"view_count":409,"download_count":5,"published_at":"2026-05-22T14:05:22.42+00:00","created_at":"2026-05-22T14:05:09.743819+00:00","updated_at":"2026-05-22T14:13:11.782473+00:00","slug":"telegram-bot-alerts-via-rest-api-2","broker_version_id":"c1e30566-74f7-4aa7-8a7a-40f51265b333","category":{"id":"e18d0cf5-a30f-4543-a1e0-f8fb2017198c","name":"General","slug":"general"},"broker_version":{"id":"c1e30566-74f7-4aa7-8a7a-40f51265b333","name":"v2.0","slug":"v2-0","sort_order":4},"author":{"id":"507e651c-7269-4e72-bf19-30eda46bba07","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/507e651c-7269-4e72-bf19-30eda46bba07/3bec3115-1a9c-4a30-9228-3f33cb80354f.jpg","display_name":"Bruno Candoso","profile_slug":"bruno-candoso"},"tags":[{"id":"006dc0eb-6782-4de1-a69b-ed76caae7479","name":"telegram","slug":"telegram"},{"id":"253ec7f2-a19e-4ec2-839d-9d6c2f6cebee","name":"botfather","slug":"botfather"},{"id":"29c99d31-b9fa-49d4-a798-e732d0a89e23","name":"alerts","slug":"alerts"},{"id":"3089e499-23cc-4a09-8e3f-e2c38b129497","name":"topics","slug":"topics"},{"id":"3be6d89d-82eb-45ac-8c66-eda89ba6918d","name":"rest-api","slug":"rest-api"},{"id":"a93e6d01-dcc3-4072-b690-a3829d0773f8","name":"Secrets","slug":"secrets"},{"id":"d9914328-a64d-4b38-9000-c26750a200ee","name":"mqtt","slug":"mqtt"}],"routes":[{"id":"e51b46bf-ebde-4f62-ba30-e561b37eed33","type":"REST_API","category":"REST API","icon_path":"e51b46bf-ebde-4f62-ba30-e561b37eed33.svg","display_name":"REST API"}]},{"id":"9519423b-0065-4c86-8dcd-475c5af00736","title":"How to connect to OPC UA","short_description":"Poll OPC UA nodes and publish tag values to MQTT topics.","content":"## What this template does\n\nThis template connects to OPC UA server and polls selected node IDs on a fixed interval. Each tag value is published to its own MQTT topic, making it easy to feed dashboards, alerts, and downstream automations.\n\n## **When to use it**\n\nUse this template when you need to ingest OPC UA data to MQTT.","difficulty":"intermediate","category_id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","author_id":"507e651c-7269-4e72-bf19-30eda46bba07","status":"published","is_visible":true,"is_featured":false,"view_count":407,"download_count":1,"published_at":"2026-05-16T19:25:45.441+00:00","created_at":"2026-05-16T19:24:31.621852+00:00","updated_at":"2026-05-21T21:43:11.774781+00:00","slug":"opc-ua-to-mqtt-route-template","broker_version_id":"c1e30566-74f7-4aa7-8a7a-40f51265b333","category":{"id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","name":"Manufacturing","slug":"manufacturing"},"broker_version":{"id":"c1e30566-74f7-4aa7-8a7a-40f51265b333","name":"v2.0","slug":"v2-0","sort_order":4},"author":{"id":"507e651c-7269-4e72-bf19-30eda46bba07","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/507e651c-7269-4e72-bf19-30eda46bba07/3bec3115-1a9c-4a30-9228-3f33cb80354f.jpg","display_name":"Bruno Candoso","profile_slug":"bruno-candoso"},"tags":[{"id":"4851c3ef-4668-412a-ad23-ae79be99dba9","name":"polling","slug":"polling"},{"id":"4e597b57-b71c-48a3-8022-df6e5c38f487","name":"opc-ua","slug":"opc-ua"},{"id":"8bef6530-d8d3-42ae-ad10-2ff9ad0c888c","name":"routing","slug":"routing"},{"id":"d9914328-a64d-4b38-9000-c26750a200ee","name":"mqtt","slug":"mqtt"},{"id":"dd16ab7d-3fae-45c8-97b5-f4b9e2a774b0","name":"sensors","slug":"sensors"},{"id":"f01dc0fe-b968-4b26-a036-a9c2eef6a754","name":"authentication","slug":"authentication"},{"id":"f170a03a-dbe3-4c66-93e5-0766bf9b448c","name":"simulation","slug":"simulation"}],"routes":[{"id":"3ae971fc-20fe-41e1-9355-a00a38197385","type":"OPCUA","category":"Industrial","icon_path":"3ae971fc-20fe-41e1-9355-a00a38197385.png","display_name":"OPC UA"}]},{"id":"0f8811a7-428d-43f7-9107-8420319c16a2","title":"Off-hours energy waste per electrical panel","short_description":"Quantify off-hours kWh waste per panel via Modbus TCP: cost, share and alerts.","content":"```\n## How it works\n\nThis Coreflux LoT template finds energy that keeps running when the plant should be quiet. It polls power meters on each electrical panel over **Modbus TCP** (or a built-in simulator), builds a 24-hour demand profile, and quantifies **off-hours kWh**, its **share of the day**, the **baseload in kW**, and the **EUR cost** at a configurable tariff. Each panel gets an off-hours kWh attribution so you can see the top offender. A LoT action raises an alert when the off-hours share or baseload crosses a policy threshold. A native Hub panel shows KPIs, the panel grid, gauges and a realtime stream.\n\n## Key features\n\n- **Modbus TCP acquisition:** Example route for panel P01 with clearly marked example registers for active power (kW) and forward energy (kWh); duplicate per meter.\n- **Configurable schedule and tariff:** Work window (default 07–22), EUR/kWh and alert thresholds live on MQTT config topics.\n- **Off-hours KPIs:** Daily kWh, off-hours kWh and %, baseload mean, working mean, EUR cost, top offender panel.\n- **Alert topics:** short status on `plant/energy/alerts/offhours` (e.g. `ALERT share > 15%` / `OK`); full text on `plant/energy/alerts/offhours_detail`.\n- **Optional simulator:** Deterministic synthetic plant so the notebook runs with no hardware; remove before production.\n- **Hub dashboard:** Compact KPI row, eight panel tiles, gauges and a realtime chart (default theme).\n\n## Prerequisites\n\n- Coreflux broker **2.22** (or 2.2+ with industrial routes).\n- Licence that includes **MODBUS_TCP** when connecting real meters.\n- One Modbus TCP meter (or gateway) per panel — **or** use the simulator for a dry run.\n- Hub (optional) to view the panel.\n\n## Setup\n\n1. Replace `<METER_IP>`, `SLAVE_ID` and register addresses with your meter map (see notebook warning).\n2. Duplicate the Modbus route for panels P02…Pn.\n3. Adjust `plant/energy/config/*` (work hours, EUR/kWh, alert thresholds).\n4. Deploy. For a hardware-free demo, deploy the simulator action; remove it for production.\n5. Open Hub panel **OffhoursEnergyWaste**.\n\n## Topic map (UNS)\n\n```\nplant/energy/panels/P0n/kw\nplant/energy/panels/P0n/kwh\nplant/energy/panels/P0n/offhours_kwh\nplant/energy/panels/P0n/baseload_kw\nplant/energy/config/work_start_hour\nplant/energy/config/work_end_hour\nplant/energy/config/eur_per_kwh\nplant/energy/config/alert_offhours_pct\nplant/energy/config/alert_baseload_kw\nplant/energy/kpi/*\nplant/energy/alerts/offhours\nplant/energy/alerts/offhours_detail\nplant/energy/alerts/offhours_active\nplant/energy/meta/title_md\nplant/energy/meta/mode\nplant/energy/summary          (collapsed model)\n```\n\n## Tested\n\nValidated on Coreflux broker 2.22.0 (Enterprise licence) with a live MODBUS_TCP route against a Modbus TCP test slave, the Hub panel deployed, and KPIs and alert checked by hand.\n```\n\n&nbsp;","difficulty":"intermediate","category_id":"9b6b6273-bc3c-440f-b1a0-b948752bfd93","author_id":"72c1f666-e2e6-4bc8-9cf2-9408f3402e7e","status":"published","is_visible":true,"is_featured":false,"view_count":0,"download_count":0,"published_at":"2026-11-09T13:20:40.368+00:00","created_at":"2026-11-09T13:18:06.087299+00:00","updated_at":"2026-11-09T13:18:06.453164+00:00","slug":"off-hours-energy-waste-per-electrical-panel","broker_version_id":"3f2908f5-ba7a-418b-9943-9b82ffd49885","category":{"id":"9b6b6273-bc3c-440f-b1a0-b948752bfd93","name":"Energy & Utilities","slug":"energy--utilities"},"broker_version":{"id":"3f2908f5-ba7a-418b-9943-9b82ffd49885","name":"v2.2","slug":"v2-2","sort_order":2},"author":{"id":"72c1f666-e2e6-4bc8-9cf2-9408f3402e7e","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/72c1f666-e2e6-4bc8-9cf2-9408f3402e7e/8339ae55-616e-463e-b75b-134041d2ee2b.png","display_name":"Hugo Vaz","profile_slug":"hugo-vaz"},"tags":[{"id":"00d1a016-71e9-428d-a835-c3f35f884d63","name":"Modbus TCP","slug":"modbus-tcp"},{"id":"077bac4d-ef9e-453e-8864-f62baf6d69ea","name":"alarms","slug":"alarms"},{"id":"0820b7e6-aef6-450f-87a9-6c8e8b8f8303","name":"off-hours","slug":"off-hours"},{"id":"16bfe910-2358-4511-b020-0499dfc2680c","name":"baseload","slug":"baseload"},{"id":"45f048e2-129f-43b1-9319-d11a701bf9e4","name":"Energy monitoring","slug":"energy-monitoring"},{"id":"90d627dc-7b9c-4c50-acc6-77866e399806","name":"modbus","slug":"modbus"},{"id":"97e864dc-f7fe-4ca6-abab-1d372c5655be","name":"kwh","slug":"kwh"},{"id":"d9914328-a64d-4b38-9000-c26750a200ee","name":"mqtt","slug":"mqtt"}],"routes":[{"id":"0c2413e6-5db8-4aff-8678-bff862b2e86e","type":"MODBUS_TCP","category":"Industrial","icon_path":"0c2413e6-5db8-4aff-8678-bff862b2e86e.webp","display_name":"Modbus TCP"}]},{"id":"e5457328-d5a3-487a-8aa7-786bae0375dc","title":"How to control Tapo Smart Bulb","short_description":"Control Tapo bulbs over MQTT with dynamic IP commands and optional color control.","content":"## What this template does\n\nEnables MQTT control for Tapo Smart Bulbs. By listening to a single MQTT topic, it accepts JSON commands containing a bulb's IP, action (`on`, `off`, `color`), and an optional color. It operates dynamically without a static registry, allowing control over any bulb on the local network.\n\n## When to use it\n\nIdeal for setups requiring flexible, dynamic control of Tapo bulbs via MQTT, without the need to pre-register individual device IPs.","difficulty":"advanced","category_id":"656ec8c6-6c8d-4e84-b943-3056f7b041d5","author_id":"507e651c-7269-4e72-bf19-30eda46bba07","status":"published","is_visible":true,"is_featured":false,"view_count":611,"download_count":2,"published_at":"2026-05-16T20:07:24.841+00:00","created_at":"2026-05-16T20:06:39.082088+00:00","updated_at":"2026-05-21T21:33:54.888626+00:00","slug":"tapo-smart-bulb-home-control","broker_version_id":"c1e30566-74f7-4aa7-8a7a-40f51265b333","category":{"id":"656ec8c6-6c8d-4e84-b943-3056f7b041d5","name":"IoT & Connected Devices","slug":"iot--connected-devices"},"broker_version":{"id":"c1e30566-74f7-4aa7-8a7a-40f51265b333","name":"v2.0","slug":"v2-0","sort_order":4},"author":{"id":"507e651c-7269-4e72-bf19-30eda46bba07","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/507e651c-7269-4e72-bf19-30eda46bba07/3bec3115-1a9c-4a30-9228-3f33cb80354f.jpg","display_name":"Bruno Candoso","profile_slug":"bruno-candoso"},"tags":[{"id":"038007d1-b806-4f9b-93cb-b1a79097c5c1","name":"home automation","slug":"home-automation"},{"id":"2e87a769-c38b-4336-8259-740ca2812b95","name":"Python","slug":"python"},{"id":"6a10d21f-b3d4-43dd-875a-5c54de5d2fad","name":"color control","slug":"color-control"},{"id":"a5a272d6-bf43-48b0-a262-6cea245e60a5","name":"smart bulb","slug":"smart-bulb"},{"id":"d9914328-a64d-4b38-9000-c26750a200ee","name":"mqtt","slug":"mqtt"},{"id":"eb96c592-93d4-40e7-82c5-84c5825175bb","name":"Tapo","slug":"tapo"}],"routes":[]},{"id":"60e32ab4-3a2b-47c1-98b4-fe1a756edaa3","title":"Brewery line simulator with own UNS","short_description":"Modbus TCP + OPC UA to MQTT Unified Namespace. PostgreSQL brewery batch historian.","content":"## What this template does\n\nA Python tick on the broker drives mixer, filler, and capper. MODBUS_SERVER and OPCUA_SERVER expose those tags on localhost. Client routes poll them onto Plant/#. PostgreSQL stores completed batches. An AGENT reads the namespace.  \n\n\n##   \nWhen to use it\n\n  \nA self-contained bottling lab — no extra simulator process. Point the client hosts at real PLCs when you have them.\n\nBrewerySim.tick → **sim**/devices/{mixer,filler,capper}/*\n\n     ├── MODBUS_SERVER MixerDevice   127.0.0.1:1501\n\n     ├── OPCUA_SERVER  FillerDevice  opc.tcp://127.0.0.1:4840\n\n     └── MODBUS_SERVER CapperDevice  127.0.0.1:1502\n\n              ↓\n\n     MixerM01 / FillerF01 / CapperC01  → Plant/#\n\n     **sim**/brewery/batch             → PostgreSQL → Plant/Historian/*/Batches\n\n##      Plant/#      \n  \n  \n  \nWhat's inside\n\n- BrewerySim — Python plant clock (jams, spoiled lots, batch close)\n- MixerDevice — MODBUS_SERVER on 127.0.0.1:1501\n- FillerDevice — OPCUA_SERVER on opc.tcp://127.0.0.1:4840\n- CapperDevice — MODBUS_SERVER on 127.0.0.1:1502\n- MixerM01 / FillerF01 / CapperC01 — clients that write Plant/#\n- BreweryTraceDb — PostgreSQL INSERT + SELECT last 20\n- BreweryAssistant — answers on brewery/assistant/reply/id  \n  \n\n\n## Steps\n\n1. Run the Python cell first (`# Script Name: BrewerySim` on line 1).\n2. Deploy SeedBreweryState, then RunBrewerySim.\n3. Deploy the three server routes, then the three client routes.\n4. Create the PostgreSQL tables, replace YOUR_DB_PASSWORD, deploy BreweryTraceDb.\n5. KEEP SECRET OPENAI_KEY once, then deploy BreweryAssistant.\n\n&nbsp;\n\n&nbsp;\n\n## Tips\n\n- Mixer listens on 1501, not 502 — the broker user cannot bind privileged ports.\n- Servers bind localhost. Change HOST / ENDPOINT_URL when a real PLC is on the wire.\n- Consumers subscribe to Plant/#. They never parse **sim**/brewery/snapshot.\n\n&nbsp;\n\n&nbsp;\n\nDocs: [Python](https://docs.coreflux.org/latest/lot-language/actions/python-integration), [Modbus server](https://docs.coreflux.org/latest/lot-language/routes/industrial/modbus-tcp-server), [OPC UA server](https://docs.coreflux.org/latest/lot-language/routes/industrial/opcua-server), [Modbus client](https://docs.coreflux.org/latest/lot-language/routes/industrial/modbus-tcp-client), [OPC UA client](https://docs.coreflux.org/latest/lot-language/routes/industrial/opcua-client), [PostgreSQL](https://docs.coreflux.org/latest/lot-language/routes/data-storage/postgresql), [AI routes](https://docs.coreflux.org/latest/lot-language/routes/ai-routes).","difficulty":"advanced","category_id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","author_id":"72c1f666-e2e6-4bc8-9cf2-9408f3402e7e","status":"published","is_visible":true,"is_featured":true,"view_count":260,"download_count":3,"published_at":"2026-08-23T19:25:43.472+00:00","created_at":"2026-08-22T18:23:51.032577+00:00","updated_at":"2026-08-22T18:23:51.304131+00:00","slug":"brewery-line-simulator-with-own-uns-2","broker_version_id":"3f2908f5-ba7a-418b-9943-9b82ffd49885","category":{"id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","name":"Manufacturing","slug":"manufacturing"},"broker_version":{"id":"3f2908f5-ba7a-418b-9943-9b82ffd49885","name":"v2.2","slug":"v2-2","sort_order":2},"author":{"id":"72c1f666-e2e6-4bc8-9cf2-9408f3402e7e","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/72c1f666-e2e6-4bc8-9cf2-9408f3402e7e/8339ae55-616e-463e-b75b-134041d2ee2b.png","display_name":"Hugo Vaz","profile_slug":"hugo-vaz"},"tags":[{"id":"00d1a016-71e9-428d-a835-c3f35f884d63","name":"Modbus TCP","slug":"modbus-tcp"},{"id":"2e87a769-c38b-4336-8259-740ca2812b95","name":"Python","slug":"python"},{"id":"4e597b57-b71c-48a3-8022-df6e5c38f487","name":"opc-ua","slug":"opc-ua"},{"id":"77e6abe8-cf80-41e5-9c46-f2a253f84aa9","name":"manufacturing","slug":"manufacturing"},{"id":"ab388864-bcc7-43a1-86a6-1da8a459f190","name":"AI agent","slug":"ai-agent"},{"id":"d8e523f0-cb3d-4af9-bd2f-056c2048be56","name":"historian","slug":"historian"},{"id":"df08f548-60b4-4c82-8b58-b2edaadaa03e","name":"uns","slug":"uns"},{"id":"f6c3c2a2-25ff-494a-9b56-12b95fa01631","name":"postgresql","slug":"postgresql"}],"routes":[{"id":"0c2413e6-5db8-4aff-8678-bff862b2e86e","type":"MODBUS_TCP","category":"Industrial","icon_path":"0c2413e6-5db8-4aff-8678-bff862b2e86e.webp","display_name":"Modbus TCP"},{"id":"1f8b882a-80e4-47a1-aa3a-2335b41f83ed","type":"OPCUA_SERVER","category":"Industrial","icon_path":"3ae971fc-20fe-41e1-9355-a00a38197385.png","display_name":"OPC UA Server"},{"id":"3280e7e3-2777-4bc3-9d73-c975b46c04f6","type":"AGENT","category":"Other","icon_path":"dd2b95db-133f-4ea8-b66e-14713e8be605.png","display_name":"Agent"},{"id":"3ae971fc-20fe-41e1-9355-a00a38197385","type":"OPCUA","category":"Industrial","icon_path":"3ae971fc-20fe-41e1-9355-a00a38197385.png","display_name":"OPC UA"},{"id":"3fb2e0db-878f-45b8-99d4-bfb066077854","type":"POSTGRESQL","category":"Data Storage","icon_path":"3fb2e0db-878f-45b8-99d4-bfb066077854.svg","display_name":"PostgreSQL"},{"id":"b818ed77-3898-41e2-9fbd-05e619432837","type":"MODBUS_SERVER","category":"Industrial","icon_path":"75ea6290-81eb-4cd8-bb49-922fbe957add.png","display_name":"Modbus Server"}]},{"id":"ef485a51-78e9-4115-8658-710fe5d5f378","title":"How to Monitor Machine Health with a Vibration Sensor","short_description":"Monitor machine health with Modbus RTU and a 3-axis vibration sensor.","content":"## **What this template does**\n\n  \nEnables continuous machine health monitoring for industrial equipment fitted with 3-axis vibration sensors. By computing real-time RMS vibration and comparing it against a self-learned baseline, it extracts a 0–100 health score that reflects the current condition of rotating machinery, without requiring manual threshold configuration. It operates autonomously, adapting the baseline to normal operating conditions, detecting sudden increases in vibration, and publishing a structured health status ready to consume in dashboards.\n\n&nbsp;\n\n## **When to use it**\n\n  \nIdeal for predictive maintenance setups where early detection of mechanical degradation, bearing wear, imbalance, or looseness, is needed before it becomes a failure.","difficulty":"advanced","category_id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","author_id":"507e651c-7269-4e72-bf19-30eda46bba07","status":"published","is_visible":true,"is_featured":true,"view_count":390,"download_count":5,"published_at":"2026-06-09T19:29:25.059+00:00","created_at":"2026-06-09T19:22:34.925885+00:00","updated_at":"2026-06-09T19:29:24.462782+00:00","slug":"modbus-vibration-sensor-health-monitor","broker_version_id":"c1e30566-74f7-4aa7-8a7a-40f51265b333","category":{"id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","name":"Manufacturing","slug":"manufacturing"},"broker_version":{"id":"c1e30566-74f7-4aa7-8a7a-40f51265b333","name":"v2.0","slug":"v2-0","sort_order":4},"author":{"id":"507e651c-7269-4e72-bf19-30eda46bba07","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/507e651c-7269-4e72-bf19-30eda46bba07/3bec3115-1a9c-4a30-9228-3f33cb80354f.jpg","display_name":"Bruno Candoso","profile_slug":"bruno-candoso"},"tags":[{"id":"065f2efe-5b01-4e39-a1e0-f328549bf5ae","name":"health monitoring","slug":"health-monitoring"},{"id":"13172a65-526a-4aee-a74d-9fe14fb390c8","name":"vibration","slug":"vibration"},{"id":"2e87a769-c38b-4336-8259-740ca2812b95","name":"Python","slug":"python"},{"id":"4cb3844c-1712-42dd-b16b-aaf63439afe3","name":"retained state","slug":"retained-state"},{"id":"5273abc1-734d-4497-b428-8d6ec9c35de1","name":"sensor monitoring","slug":"sensor-monitoring"},{"id":"7d38e1c9-bf94-42a7-b2a9-90bf0ada5008","name":"RMS","slug":"rms"},{"id":"83560dc9-f2db-4f30-bc9d-7bb6a82fb38a","name":"Modbus RTU","slug":"modbus-rtu"},{"id":"d9914328-a64d-4b38-9000-c26750a200ee","name":"mqtt","slug":"mqtt"}],"routes":[{"id":"ec78fb08-f861-4d3e-be30-89f68ae002b3","type":"MODBUS_SERIAL","category":"Industrial","icon_path":"ec78fb08-f861-4d3e-be30-89f68ae002b3.webp","display_name":"Modbus Serial"}]},{"id":"9db6a18b-3e12-4bb7-9105-adae90d5cc52","title":"OEE in 15 Minutes: Line Pulse","short_description":"Compute OEE for every machine on the broker, with PostgreSQL history and Grafana gauges.","content":"## How it works\n\nThis Coreflux LoT template computes OEE for every machine on a line, on the broker, every 5 seconds. Machine state, a parts counter and a scrap counter come in under `raw/factory/hall-a/line-1/<machine>/...`. A line clock ticks each machine, and one Action adds the tick to a run, idle or fault bucket, counts parts made and scrapped since the shift started, and publishes Availability, Performance, Quality and OEE to `factory/hall-a/line-1/<machine>/oee`. It runs on the free Community licence.\n\n## Key features\n\n- The whole OEE definition sits in one Action, `OeeMachineCalc`, in four lines you can read and change.\n- The ideal cycle time is a retained config topic per machine. Change it and Performance moves on the next record.\n- Shifts start at 06:00 on weekdays or when you publish to `factory/hall-a/line-1/shift/cmd/start`.\n- Counter baselines survive a PLC restart: if a counter goes backwards the count does not go negative.\n- A `POSTGRESQL` route stores every record, and the compose file brings up PostgreSQL and a Grafana dashboard with a gauge per machine.\n- It uses 8 of the 24 LoT artifacts and 2 of the 3 routes the Community licence allows.\n\n## Prerequisites\n\n- Coreflux broker 2.14.3 or newer. The free Community licence is enough.\n- No hardware: three simulated machines give different OEE numbers within a minute.\n- For real data, a PLC that speaks Modbus TCP, with its host in ENV `OEE_PLC_HOST`.\n- For history and the dashboard, Docker and the secret `OEE_DB_PASSWORD`.\n\n## Setup\n\n1. Run the Models, then the Actions.\n2. Run the simulator cells.\n3. Subscribe to `factory/hall-a/line-1/+/oee`. Each machine reports every 5 seconds.\n4. Publish `3.0` with retain to `config/oee/line-1/machine1/ideal_cycle_s` and watch machine1's Performance change.\n5. Start the compose stack and run the historian route when you want history in Grafana.\n6. The Rule appendix at the end needs a Growth or Enterprise licence. On Community, skip it.\n\n## What this template does\n\n- Publishes an OEE record per machine at `factory/hall-a/line-1/<machine>/oee` with A, P, Q, OEE, run, idle and fault seconds, and good and scrap parts.\n- Resets the counts at every shift start.\n- Writes every record to the `oee_kpi` table when the historian route is on.\n- On a paid licence, the optional Rule lets only `root` and a `production-planner` user change the OEE config.\n\n## How to customize\n\n- Add a machine to the list in `OeeLineClock` and, on hardware, a mapping to the Modbus route.\n- Edit the register map to match your PLC.\n- Change the formulas in `OeeMachineCalc` if your site treats idle time as a performance loss.\n- Add shift start Actions for a two or three shift pattern, or let your MES publish the shift start.\n\n&nbsp;\n\n&nbsp;","difficulty":"intermediate","category_id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","author_id":"507e651c-7269-4e72-bf19-30eda46bba07","status":"published","is_visible":true,"is_featured":false,"view_count":12,"download_count":0,"published_at":"2026-10-14T10:48:11.537+00:00","created_at":"2026-10-14T10:48:10.528143+00:00","updated_at":"2026-10-14T10:48:10.623618+00:00","slug":"oee-in-15-minutes-line-pulse","broker_version_id":"db7c468f-1f4e-4ba5-ab82-2fac63ecf379","category":{"id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","name":"Manufacturing","slug":"manufacturing"},"broker_version":{"id":"db7c468f-1f4e-4ba5-ab82-2fac63ecf379","name":"v2.14.3","slug":"v2-14-3","sort_order":1},"author":{"id":"507e651c-7269-4e72-bf19-30eda46bba07","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/507e651c-7269-4e72-bf19-30eda46bba07/3bec3115-1a9c-4a30-9228-3f33cb80354f.jpg","display_name":"Bruno Candoso","profile_slug":"bruno-candoso"},"tags":[],"routes":[{"id":"0c2413e6-5db8-4aff-8678-bff862b2e86e","type":"MODBUS_TCP","category":"Industrial","icon_path":"0c2413e6-5db8-4aff-8678-bff862b2e86e.webp","display_name":"Modbus TCP"},{"id":"3fb2e0db-878f-45b8-99d4-bfb066077854","type":"POSTGRESQL","category":"Data Storage","icon_path":"3fb2e0db-878f-45b8-99d4-bfb066077854.svg","display_name":"PostgreSQL"}]},{"id":"b4e56def-0c73-4fb8-99d3-ff2379a6fe9a","title":"Stop Ledger: every stop, its reason and its seconds","short_description":"Log every machine stop with its reason code and seconds down, plus a live Pareto per machine.","content":"## How it works\n\nThis Coreflux LoT template turns a machine state signal into a downtime log on the broker. Raw state comes in under `raw/factory/hall-a/line-1/<machine>/machine_state` (`0` planned stop, `1` running, `2` idle, `3` fault). A line clock ticks each machine every 5 seconds. When a machine goes idle or faults, one Action opens a downtime episode, counts its seconds and closes it when the machine runs again. Operators send a reason code over MQTT from any HMI button, scanner or phone app. Stops shorter than 60 seconds are filed as micro-stops, and stops nobody coded stay as `unknown`, so the Pareto shows how much downtime has no explanation. It runs on the free Community licence.\n\n## Key features\n\n- An episode record per stop at `factory/hall-a/line-1/<machine>/stops/episode`, with an id, the reason, the class (`stop` or `micro_stop`) and the seconds down.\n- Reason codes on `factory/hall-a/line-1/<machine>/stops/cmd/reason`. A code sent after the machine restarts goes on the last uncoded stop, and its seconds move from `unknown` to the new reason.\n- Every reason code is answered on `stops/reason/ack` with the user name that sent it. Codes outside the list are rejected.\n- An alert on `alerts/factory/hall-a/line-1/<machine>/stop_uncoded` when a stop is still uncoded after 90 seconds.\n- A live Pareto per machine and per line at `stops/pareto/<reason>`, reset at every shift start. The Pareto topics are published with `RETAIN`, new in broker 2.22, so a dashboard that connects in the middle of a shift gets the current numbers at once.\n- It reads the same state register as \"OEE in 15 Minutes: Line Pulse\", so both can run on the same line.\n- It uses 13 of the 24 LoT artifacts and up to 2 of the 3 routes the Community licence allows. No Rules.\n\n## Prerequisites\n\n- Coreflux broker 2.22.0 or newer. The free Community licence is enough. On 2.14, delete the word `RETAIN` from the Pareto lines in `StopTracker` and `StopShiftStart`; the rest is the same.\n- No hardware: three simulated machines and a simulated operator show every path within a few minutes.\n- For real data, a PLC that speaks Modbus TCP, with its host in ENV `STOPS_PLC_HOST`.\n- For history, a PostgreSQL database, its connection in ENV `STOPS_DB_HOST`, `STOPS_DB_PORT`, `STOPS_DB_NAME`, `STOPS_DB_USER`, and the secret `STOPS_DB_PASSWORD`.\n\n## Setup\n\n1. Run the Models, then the Actions.\n2. Run the simulator cells.\n3. Subscribe to `factory/hall-a/line-1/+/stops/#` and `alerts/#`.\n4. Within a minute machine3 shows `is_down` 1 with `open_reason` `unknown`. Publish `jam` to `factory/hall-a/line-1/machine3/stops/cmd/reason` and read the ack.\n5. Create the `stop_episode` table from the route cell and run `StopHistorian` when you want history.\n6. Remove the three simulator Actions before you run `StopLinePlc` against a real PLC.\n\n## What this template does\n\n- Opens, tracks and closes a downtime episode per machine stop.\n- Files short stops as micro-stops (60 seconds by default) so the long stops stay visible.\n- Takes reason codes during or after a stop and records who sent them.\n- Raises one alert per stop that stays uncoded past 90 seconds.\n- Publishes a live summary per machine every 5 seconds and a Pareto of downtime seconds per reason.\n- Writes every closed and recoded episode to the `stop_episode` table when the historian route is on.\n\n## How to customize\n\n- Change the micro-stop and alert thresholds with retained values on `config/stops/line-1/micro_stop_s` and `config/stops/line-1/escalate_s`.\n- Edit the reason list in `StopReasonIntake` to match your plant's codes.\n- Add a machine with one line in `StopLineClock` and a mapping in `StopLinePlc`.\n- Add a shift start Action per shift, or let your MES publish to `factory/hall-a/line-1/shift/cmd/start`.\n- Retained Pareto values stay on the broker after you remove the template. Clear them by publishing an empty retained message to each `stops/pareto/<reason>` topic.\n- On a Growth or Enterprise licence, add a Rule so only operators can publish reason codes. That Rule is not part of the Community path.\n\n&nbsp;","difficulty":"intermediate","category_id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","author_id":"507e651c-7269-4e72-bf19-30eda46bba07","status":"published","is_visible":true,"is_featured":true,"view_count":0,"download_count":0,"published_at":"2026-11-02T12:22:05.343+00:00","created_at":"2026-11-02T12:22:04.032801+00:00","updated_at":"2026-11-02T12:22:04.242479+00:00","slug":"stop-ledger-every-stop-its-reason-and-its-seconds","broker_version_id":"db7c468f-1f4e-4ba5-ab82-2fac63ecf379","category":{"id":"c65536f1-6004-44a2-bc21-3c8f78fe5299","name":"Manufacturing","slug":"manufacturing"},"broker_version":{"id":"db7c468f-1f4e-4ba5-ab82-2fac63ecf379","name":"v2.14.3","slug":"v2-14-3","sort_order":1},"author":{"id":"507e651c-7269-4e72-bf19-30eda46bba07","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/507e651c-7269-4e72-bf19-30eda46bba07/3bec3115-1a9c-4a30-9228-3f33cb80354f.jpg","display_name":"Bruno Candoso","profile_slug":"bruno-candoso"},"tags":[],"routes":[{"id":"0c2413e6-5db8-4aff-8678-bff862b2e86e","type":"MODBUS_TCP","category":"Industrial","icon_path":"0c2413e6-5db8-4aff-8678-bff862b2e86e.webp","display_name":"Modbus TCP"},{"id":"3fb2e0db-878f-45b8-99d4-bfb066077854","type":"POSTGRESQL","category":"Data Storage","icon_path":"3fb2e0db-878f-45b8-99d4-bfb066077854.svg","display_name":"PostgreSQL"}]},{"id":"18a9ad0e-25a6-433d-b90e-0ea55d2c7e20","title":"How to Sync FTP CSV Files to a PostgreSQL Database","short_description":"Poll an FTP CSV file with Python to MQTT and store typed rows in PostgreSQL.","content":"## What this template does\n\nBuild a zero-middleware historian for legacy devices that drop CSV files on FTP. A Python reads the latest non-empty row from the file, detects changes, and new readings are published to MQTT and stored in PostgreSQL with a typed model.\n\n## When to use it\n\nUse this template when you need to ingest file-based telemetry from older systems.","difficulty":"advanced","category_id":"e18d0cf5-a30f-4543-a1e0-f8fb2017198c","author_id":"507e651c-7269-4e72-bf19-30eda46bba07","status":"published","is_visible":true,"is_featured":false,"view_count":385,"download_count":5,"published_at":"2026-05-12T19:58:22.924+00:00","created_at":"2026-05-12T19:58:09.400827+00:00","updated_at":"2026-05-15T20:11:05.812214+00:00","slug":"ftp-csv-historian-to-postgresql","broker_version_id":"c1e30566-74f7-4aa7-8a7a-40f51265b333","category":{"id":"e18d0cf5-a30f-4543-a1e0-f8fb2017198c","name":"General","slug":"general"},"broker_version":{"id":"c1e30566-74f7-4aa7-8a7a-40f51265b333","name":"v2.0","slug":"v2-0","sort_order":4},"author":{"id":"507e651c-7269-4e72-bf19-30eda46bba07","avatar_url":"https://iliafehitnwryrjpfqxv.supabase.co/storage/v1/object/public/avatars/507e651c-7269-4e72-bf19-30eda46bba07/3bec3115-1a9c-4a30-9228-3f33cb80354f.jpg","display_name":"Bruno Candoso","profile_slug":"bruno-candoso"},"tags":[{"id":"001a63f5-73a9-4f30-aaf9-a1a99bb2b493","name":"CSV","slug":"csv"},{"id":"29f27581-22c0-463d-a670-6f539d85958c","name":"data ingestion","slug":"data-ingestion"},{"id":"2e87a769-c38b-4336-8259-740ca2812b95","name":"Python","slug":"python"},{"id":"55e45f0b-f698-4b1a-ba89-34ff43e432c1","name":"FTP","slug":"ftp"},{"id":"d8e523f0-cb3d-4af9-bd2f-056c2048be56","name":"historian","slug":"historian"},{"id":"d9914328-a64d-4b38-9000-c26750a200ee","name":"mqtt","slug":"mqtt"},{"id":"f6c3c2a2-25ff-494a-9b56-12b95fa01631","name":"postgresql","slug":"postgresql"}],"routes":[{"id":"3fb2e0db-878f-45b8-99d4-bfb066077854","type":"POSTGRESQL","category":"Data Storage","icon_path":"3fb2e0db-878f-45b8-99d4-bfb066077854.svg","display_name":"PostgreSQL"}]}]}