MQTT Commands
The CC2 device communicates with the backend over MQTT. All configuration, device data, UI widget updates, and housekeeping actions are sent as JSON payloads on dedicated topics.
Connections are managed through the network defined in your configuration files, with automatic reconnect and timeout handling.
// Every MQTT message (downlink or uplink) uses this top-level structure.// Include only the sections you need — empty objects can be omitted.{ "devcfg": {}, // configure device behaviour "devdata": {}, // request or report device data "devwork": [], // one-shot housekeeping actions "app": {} // widget data and UI actions}MQTT Topics
Section titled “MQTT Topics”All MQTT communication uses the following topic patterns:
| Direction | Description | Topic Pattern |
|---|---|---|
| Downlink | Commands sent to the device (devcfg, devwork, app) | ife/{env}/device/msgs-down/{deviceId} |
| Uplink | Data reported by the device (devdata, app) | ife/{env}/device/msgs-up/{deviceId} |
Worked Example
Section titled “Worked Example”- Environment (
{env}):Infrafon_dev - Device ID (
{deviceId}):38b8ebe10273
| Direction | Topic |
|---|---|
| Downlink | ife/Infrafon_dev/device/msgs-down/38b8ebe10273 |
| Uplink | ife/Infrafon_dev/device/msgs-up/38b8ebe10273 |
Downlink
Section titled “Downlink”Commands sent from the backend to the device. They change settings, request data, trigger actions, and push widget updates.
| Topic | Description | Page |
|---|---|---|
| Device Config | Set persistent parameters (devcfg) | Downlink → dev-config |
| Device Work | Fire-and-forget actions (devwork) | Downlink → dev-work |
| App | Widget data and UI actions (app) | Downlink → app |
Uplink
Section titled “Uplink”Data sent from the device to the backend. The device reports state, sensor readings, alert status, and app/widget events.
| Topic | Description | Page |
|---|---|---|
| Device Data | Dynamic values reported by the device (devdata) | Uplink → dev-data |
| App | Widget value changes and user interactions (app) | Uplink → app |
Related
Section titled “Related”- Configuration Files — how
global.json,allocdata.json, andunallocdata.jsondefine the device setup - Network Setup — WiFi, BLE, LoRa network definitions and connection order
- Device States — the full state machine (allocated, unallocated, provisioning, …)
- Reference Tables — enums, action shortnames, LED & audio codes, and changelog