Documentation Index
Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
Use this file to discover all available pages before exploring further.
From Device to Database, End to End
Putting the patterns together, a full ingestion pipeline has four stages, each one a single LoT entity. This is the canonical recipe for “get data from a real device, normalize it, and store it for analytics.”When to Reach for This
The first time you need persistent, queryable history of your data — usually somewhere between “it works on my laptop” and “we need to show this to the customer.” It’s also the natural foundation for Live KPIs from a Database and any reporting or analytics layer you’ll add later.The Worked Example
A smart-building HVAC chiller, communicating via Modbus, normalized into a unified schema, and stored in PostgreSQL.Stage 1 — Industrial Route Ingests from the Device
Pick the route type that matches your protocol:MODBUS for HVAC controllers, OPCUA for PLCs, S7 for Siemens, ALLEN_BRADLEY for Rockwell, BACNET for building automation. Map each register or tag to a UNS topic.
Stage 2 — Action Processes and Normalizes
Type-cast, scale, validate, then call a Model to produce structured output. A wildcard trigger means the same Action handles every chiller in every building.Stage 3 — Model Standardizes the Schema
One JSON shape for every chiller in every building. Add fields here once, every consumer downstream sees them.Stage 4 — Database Route Persists
A single insert per published reading. Credentials come fromENV and SECRET so the route is portable between environments.
ChillerReading and updating the SQL — all the Actions stay untouched.
The same four-stage recipe fits any vertical: a solar inverter via Modbus, a traffic light controller via REST, a delivery van via cellular MQTT. Different devices, different protocols, same shape.
Splitting Edge from Cloud with a Bridge
In a typical production setup, the edge broker runs on-site and handles all the high-frequency, device-facing work — every reading, every command, every alarm. The cloud broker sits centrally and only sees what the business needs to see — minute aggregates, alerts, cross-site rollups. AnMQTT_BRIDGE route is what selectively forwards data between the two.
When to Reach for This
| Reason | What it gives you |
|---|---|
| Bandwidth and cost | Raw sensor data at 1 Hz from 100 devices is a lot. Aggregating to one summary per minute can shrink uplink traffic by 99% — and your cloud bill with it. |
| Edge processing speed | Local alarms react in milliseconds without waiting for a cloud round-trip. Even if the WAN goes down, the edge keeps running. |
| Resilience | If the cloud connection drops, the edge buffers and reconnects automatically. Operations never stop because of a flaky uplink. |
| Data and security boundary | Sensitive raw data never leaves the site. Only the summarized, business-relevant information crosses the boundary. |
| Multi-site rollups | The cloud sees every site through the same shape (lisbon-park/..., madrid-park/...), enabling cross-site analytics and dashboards without changing edge logic. |
What’s Where: A Concrete Example
Imagine an edge broker at a solar park with multiple inverters. Each inverter publishes voltage, current, and power readings several times a second. Here’s what each broker actually contains:| Topic on edge broker (at the park) | What it is | Goes to cloud? |
|---|---|---|
inverters/inv-01/voltage | Raw reading every second | ❌ Stays local |
inverters/inv-01/current | Raw reading every second | ❌ Stays local |
inverters/inv-01/power | Raw reading every second | ❌ Stays local |
inverters/inv-02/power | Raw reading from another inverter | ❌ Stays local |
state/inv-01/last_seen | Internal state via KEEP TOPIC | ❌ Stays local |
aggregates/inv-01/1min | Computed every 60 seconds by an Action | ✅ Forwarded |
aggregates/inv-02/1min | Same, for the second inverter | ✅ Forwarded |
alerts/inv-01/low_output | Threshold alarm | ✅ Forwarded |
| Topic on cloud broker (after bridge) | Source |
|---|---|
lisbon-park/aggregates/inv-01/1min | Forwarded from the Lisbon edge |
lisbon-park/aggregates/inv-02/1min | Forwarded from the Lisbon edge |
lisbon-park/alerts/inv-01/low_output | Forwarded from the Lisbon edge |
madrid-park/aggregates/inv-A/1min | Forwarded from a different site |
| … | (one prefix per park) |
Step 1: Create the Aggregate at the Edge
An Action on the edge computes a summary every minute, per inverter. This is what gets sent up.cache/ topics get filled by other Actions that consume the raw inverters/ stream — kept internal to the edge using KEEP TOPIC.)
Step 2: Define the Bridge
Three topic mappings. Aggregates and alerts go up; commands come down. Everything else stays local.lisbon-park) is added on the cloud side, so multiple parks — or buildings, or cities, or fleet regions — can coexist on the same cloud broker without topic collisions.
Complementary Patterns on the Cloud
Once the cloud is receiving aggregates and alerts as MQTT topics, you can compose more patterns on top of it:- Cloud database route for central analytics. Add a PostgreSQL or CrateDB route on the cloud broker that subscribes to
+/aggregates/#and inserts into a multi-site table. Now you have one historian with data from every site, queryable for trends, capacity planning, and cross-park benchmarks. The exact sameEVENT ... QUERYpattern from the Live KPIs from a Database section works here. - Cloud dashboards. External visualization tools (or MQTT clients) subscribed to
+/aggregates/#and+/alerts/#on a cloud broker give corporate or operations teams a unified view of every site. - Cross-site KPIs. A scheduled
EVENTon the cloud’s database can publish company-wide KPIs (SELECT AVG(...) GROUP BY site_id) as MQTT topics, just like a single-site KPI — but rolled up across the whole portfolio. - AI / MCP routes on the cloud. Plug an
AGENTroute into the cloud broker so an AI assistant can answer questions about the entire fleet without ever needing to touch the edge.
Next Steps
Data Storage Routes
Historians, inserts, and scheduled queries across database types.
Connecting to the outside world
REST, KPIs, and credentials from this guide.

