MQTT Telemetry & Protocol Reference

MQTT Plugins &
Payloads Map

Complete end-user reference mapping all MQTT topics, telemetry envelopes, composite JSON payloads, remote commands, and calibration workflows across all AutoSense plugins.

Standard JSON Envelope Capability Manifest Composite JSON (mqttJson) Remote Commands Calibration Workflows

Plugins Telemetry & Command Map

Quick matrix of all compiled plugins, their default MQTT topics, metrics, payload formats, and capability actions.

ID Sensor / Module Bus Default MQTT Publish Topic Metric Payload Format Inbound Action / Calibration
P001 SSD1306 OLED Display I²C (None - Local display output) — OLED Priority Renderer —
P002 DHT11 / DHT22 Temp & Humidity Digital {device}/DHT/Temperature
{device}/DHT/Humidity
Temperature
Humidity
Single-Value (2 topics) —
P003 MQ135 Air Quality (CO₂) Analog {device}/P003/Value CO2 Single-Value (ppm) Portal Wizard
P004 DS18B20 Temp Probe 1-Wire {device}/DS18B20/Temperature DS18B20 Single-Value (°C) Semantic source
P005 Electrochemical O₂ Sensor I²C {device}/O2/Value O2 Single-Value (%) —
P006 pH Probe (2-Point Buffers) Analog {device}/PH/Value PH Single-Value (ppm unit) cmd/calibrate_ph
P007 TDS Water Quality Sensor Analog {device}/TDS/Value TDS Single-Value (ppm) Temp-compensated
P008 MQ-9 Carbon Monoxide (CO) Analog {device}/P008/Value CO Single-Value (ppm) Portal Wizard
P010 BME688 / BME680 Multi-Sensor I²C {device}/BME688/Data BME688 Composite JSON —
P011 MiCS-5524 Multi-Gas (CO/ETH/H₂) Analog {device}/MiCS5524/Data MiCS5524 Composite JSON cmd/calibrate_mics
P012 TCS3200 Colour Frequency Digital {device}/TCS3200/Value TCS3200 Composite JSON —
P013 HC-SR04 Ultrasonic Distance Digital {device}/HCSR04/Data HCSR04 Composite JSON —
ℹ️
Note on Dynamic Topics: {device} represents the Device Name configured under Settings (default: Autosense). Topic and Metric names can be customized independently for each module in the AutoSense Web Portal.

AutoSense Telemetry Envelopes

Every sensor reading published by AutoSense is delivered inside a standardized JSON envelope. The envelope supports both single metrics and composite multi-channel dictionaries. location is the device Location set in the portal (Settings → Device); when it's empty, Lab 1 is sent.

1. Single-Value Message Format

Used by standard sensors (DHT, DS18B20, pH, TDS, MQ sensors). The value field carries the numeric floating-point reading, unit its unit, and rawJson is null.

{
  "sensorType": "DHT",
  "location": "Lab 1",
  "manufacturer": "Autosense",
  "unit": "°C",
  "metric": "Temperature",
  "value": 24.30,
  "rawJson": null,
  "mac": "24:6F:28:AA:BB:CC"
}

2. Composite JSON Format (mqttJson)

Used by multi-reading modules (BME688, MiCS-5524, TCS3200, HC-SR04). All readings are grouped atomically into the rawJson dictionary, each as {"value", "unit"} because channels can have different units. There is no top-level unit; a unitless channel has "unit": "" and a failed reading "value": null.

{
  "sensorType": "BME688",
  "location": "Lab 1",
  "manufacturer": "Autosense",
  "metric": "BME688",
  "rawJson": {
    "temperature": { "value": 22.8, "unit": "°C" },
    "humidity": { "value": 45.2, "unit": "%" },
    "pressure": { "value": 1012.4, "unit": "hPa" },
    "gasResistance": { "value": 38240, "unit": "Ω" }
  },
  "mac": "24:6F:28:AA:BB:CC"
}

System Topics, LWT & Discovery

Connection Status, Heartbeat & LWT

autosense/{mac}/status

Published with retain = true on connect (value: "online"), repeated every 10 seconds as a heartbeat. If the device abruptly drops connection, the broker delivers the Last Will and Testament (LWT) payload with value: "offline". Every device has its own status topic, so subscribe to autosense/+/status to see all of them. The MQTT client ID is autosense-<MAC without colons>, unique per board.

{
  "timestamp": 1284500,
  "value": "online",
  "mac": "24:6F:28:AA:BB:CC",
  "fwVersion": "2.3.0",
  "ip": "192.168.1.120"
}

Dynamic Capability Discovery Manifest

autosense/{mac}/capabilities

Published with retain = true on boot and whenever modules or settings change. External hubs (Home Assistant, Node-RED) use this manifest to automatically generate controls and wizards.

{
  "mac": "24:6F:28:AA:BB:CC",
  "version": "2.3.0",
  "capabilities": [
    {
      "id": "reboot",
      "label": "Reboot Device",
      "action": "autosense/24:6F:28:AA:BB:CC/cmd/reboot",
      "type": "trigger",
      "confirmRequired": true
    },
    {
      "id": "sample_interval",
      "label": "Sample Interval",
      "action": "autosense/24:6F:28:AA:BB:CC/cmd/set_interval",
      "type": "number",
      "description": "Seconds between readings",
      "min": 1,
      "max": 3600,
      "step": 5,
      "unit": "s"
    },
    {
      "id": "calibrate_ph",
      "label": "Calibrate pH",
      "action": "autosense/24:6F:28:AA:BB:CC/cmd/calibrate_ph",
      "type": "trigger",
      "readingTopic": "autosense/24:6F:28:AA:BB:CC/calibration/ph/reading",
      "readingFields": [ ... ],
      "steps": [ ... ]
    }
  ]
}

Inbound Device Commands

Core Actions
Reboot Board
autosense/{mac}/cmd/reboot

Any payload or {"action":"reboot"} restarts the ESP after 500ms.

Set Measurement Interval
autosense/{mac}/cmd/set_interval

Send {"value":30} (seconds between 1 and 3600); saved to EEPROM immediately.

Home Assistant MQTT Discovery

Since v2.3.0

Off by default. Turn it on in the web portal under Settings → Home Assistant → MQTT discovery (applied immediately, no reboot). AutoSense then publishes one retained config per entity, and Home Assistant creates a single device with a sensor for every reading of the enabled modules, a Reboot button, the reading interval and the IP address. Entities become unavailable when the board goes offline; turning discovery off removes them.

Discovery Config Topic (Retained)
homeassistant/{component}/autosense_{mac}/{id}/config

{mac} is lower case without colons, e.g. autosense_246f28aabbcc. Sensors use {plugin}_{reading} as id (e.g. p006_ph), plus reboot, sample_interval and ip.

State & Availability
existing telemetry topics · autosense/{mac}/status

No new telemetry topics. Alexa and Google Home can use these sensors through Home Assistant.

Individual Plugin Payloads

Detailed channel schema, MQTT payload examples, and inbound commands for each module.

P001

SSD1306 OLED Display (Core)

I²C · Bus Display

P001 owns the physical display. It does not publish to MQTT; instead, all other active plugins declare priority tags (priority 1–3) on their channels, and the core dynamically renders the most critical telemetry to the OLED.

Default Address
0x3C (I²C)
Screen Resolutions
128x64 or 128x32 px
MQTT Telemetry
None (Display Sink)
P002

DHT11 / DHT22 Temperature & Humidity

Digital · GPIO 14

Publishes two separate single-value MQTT messages every cycle: temperature in °C and relative humidity in %.

Slot 1 Topic (Temperature)
{device}/DHT/Temperature
Slot 2 Topic (Humidity)
{device}/DHT/Humidity
Temperature Payload:
{
  "sensorType": "DHT",
  "location": "Lab 1",
  "manufacturer": "Autosense",
  "unit": "°C",
  "metric": "Temperature",
  "value": 23.40,
  "rawJson": null,
  "mac": "24:6F:28:AA:BB:CC"
}
Humidity Payload:
{
  "sensorType": "DHT",
  "location": "Lab 1",
  "manufacturer": "Autosense",
  "unit": "%",
  "metric": "Humidity",
  "value": 54.20,
  "rawJson": null,
  "mac": "24:6F:28:AA:BB:CC"
}
P003

MQ135 Air Quality (CO₂ Estimate)

Analog · A0 / ADC1

Measures air quality using an analog voltage curve to calculate approximate CO₂ parts-per-million (ppm). Features a live R0 baseline calibration wizard in the web portal.

Default Publish Topic
{device}/P003/Value
Default Metric
CO2 (unit: ppm)
{
  "sensorType": "CO2",
  "location": "Lab 1",
  "manufacturer": "Autosense",
  "unit": "ppm",
  "metric": "CO2",
  "value": 418.00,
  "rawJson": null,
  "mac": "24:6F:28:AA:BB:CC"
}
P004

DS18B20 Waterproof Temperature Probe

1-Wire · GPIO 4

High-precision waterproof digital temperature probe. Publishes liquid temperature in °C. Other modules (pH, TDS) look up this reading dynamically to apply automatic temperature compensation.

Default Publish Topic
{device}/DS18B20/Temperature
Default Metric
DS18B20 (unit: °C)
{
  "sensorType": "DS18B20",
  "location": "Lab 1",
  "manufacturer": "Autosense",
  "unit": "°C",
  "metric": "DS18B20",
  "value": 18.65,
  "rawJson": null,
  "mac": "24:6F:28:AA:BB:CC"
}
P005

Electrochemical Oxygen (O₂) Sensor

I²C · Addr 0x70–0x73

Reads ambient or enclosed oxygen concentration percentage via DFRobot electrochemical I²C sensor.

Default Publish Topic
{device}/O2/Value
Default Metric
O2 (unit: %)
{
  "sensorType": "O2",
  "location": "Lab 1",
  "manufacturer": "Autosense",
  "unit": "%",
  "metric": "O2",
  "value": 20.92,
  "rawJson": null,
  "mac": "24:6F:28:AA:BB:CC"
}
P006

pH Probe (Two-Point Buffer Calibration)

Analog · Two-Point Cal

Laboratory pH sensor with slope and intercept calculated from two reference buffers (typically pH 4.01 and 6.86). Temperature-compensated if P004 is active.

Default Publish Topic
{device}/PH/Value
Default Metric & Unit
PH (unit: none, pH is dimensionless)
MQTT Calibration Command
autosense/{mac}/cmd/calibrate_ph
Telemetry Reading:
{
  "sensorType": "PH",
  "location": "Lab 1",
  "manufacturer": "Autosense",
  "unit": "",
  "metric": "PH",
  "value": 3.72,
  "rawJson": null,
  "mac": "24:6F:28:AA:BB:CC"
}

Calibration Workflow over MQTT:

Send actions to autosense/{mac}/cmd/calibrate_ph and subscribe to autosense/{mac}/calibration/ph/reading for live feedback:

1. Start
{"action":"start"}
2. Low Buffer
{"action":"capture","point":"min"}
3. High Buffer
{"action":"capture","point":"max"}
4. Stop & Save
{"action":"stop"}
P007

Total Dissolved Solids (TDS) Probe

Analog · Temp Compensated

Measures total dissolved ions in water in ppm. Includes hardware median filtering and automatic temperature compensation against 25 °C using P004 DS18B20 readings.

Default Publish Topic
{device}/TDS/Value
Default Metric
TDS (unit: ppm)
{
  "sensorType": "TDS",
  "location": "Lab 1",
  "manufacturer": "Autosense",
  "unit": "ppm",
  "metric": "TDS",
  "value": 325.00,
  "rawJson": null,
  "mac": "24:6F:28:AA:BB:CC"
}
P008

MQ-9 Carbon Monoxide (CO) Sensor

Analog · A0 / ADC1

Detects carbon monoxide concentrations (ppm) with exponential regression curve. Features web portal clean-air baseline calibration.

Default Publish Topic
{device}/P008/Value
Default Metric
CO (unit: ppm)
{
  "sensorType": "CO",
  "location": "Lab 1",
  "manufacturer": "Autosense",
  "unit": "ppm",
  "metric": "CO",
  "value": 11.80,
  "rawJson": null,
  "mac": "24:6F:28:AA:BB:CC"
}
P010

BME688 / BME680 Environmental Multi-Sensor

I²C · Composite JSON

Multi-channel digital sensor. All 4 readings (temperature, humidity, barometric pressure, and MOX gas resistance in Ohms) are bundled into a single JSON object inside rawJson.

Default Publish Topic
{device}/BME688/Data
Default Metric
BME688
I²C Address
0x77 (default) or 0x76
{
  "sensorType": "BME688",
  "location": "Lab 1",
  "manufacturer": "Autosense",
  "metric": "BME688",
  "rawJson": {
    "temperature": { "value": 22.4, "unit": "°C" },
    "humidity": { "value": 47.1, "unit": "%" },
    "pressure": { "value": 1012.8, "unit": "hPa" },
    "gasResistance": { "value": 39500, "unit": "Ω" }
  },
  "mac": "24:6F:28:AA:BB:CC"
}
P011

MiCS-5524 Multi-Gas (CO, Ethanol, H₂)

Analog · Composite JSON & Cal

Measures carbon monoxide, ethanol, and hydrogen gas concentrations based on sensor resistance ratio Rs/R0. Supports full remote calibration capability over MQTT.

Default Publish Topic
{device}/MiCS5524/Data
Default Metric
MiCS5524
MQTT Calibration Command
autosense/{mac}/cmd/calibrate_mics
Telemetry Reading:
{
  "sensorType": "MiCS5524",
  "location": "Lab 1",
  "manufacturer": "Autosense",
  "metric": "MiCS5524",
  "rawJson": {
    "adc": { "value": 1410.20, "unit": "" },
    "rs": { "value": 23100.40, "unit": "Ω" },
    "ratio": { "value": 1.12, "unit": "" },
    "co": { "value": 3.65, "unit": "ppm" },
    "ethanol": { "value": 1.48, "unit": "ppm" },
    "h2": { "value": 0.85, "unit": "ppm" }
  },
  "mac": "24:6F:28:AA:BB:CC"
}

Calibration Capability:

Place sensor in clean air. Send actions to autosense/{mac}/cmd/calibrate_mics:

1. Start Accumulating
{"action":"start"}
2. Capture Baseline
{"action":"capture"}
3. Stop & Save
{"action":"stop"}
P012

TCS3200 Colour Frequency Sensor

Digital · Composite JSON

Colour recognition sensor. Measures square-wave frequency output in Hz for red, green, blue, and clear light filters.

Default Publish Topic
{device}/TCS3200/Value
Default Metric
TCS3200
{
  "sensorType": "TCS3200",
  "location": "Lab 1",
  "manufacturer": "Autosense",
  "metric": "TCS3200",
  "rawJson": {
    "red": { "value": 1490, "unit": "Hz" },
    "green": { "value": 2930, "unit": "Hz" },
    "blue": { "value": 3150, "unit": "Hz" },
    "clear": { "value": 7580, "unit": "Hz" }
  },
  "mac": "24:6F:28:AA:BB:CC"
}
P013

HC-SR04 Ultrasonic Distance & Level

Digital · Composite JSON

Ultrasonic range finder. Computes target distance in cm, container liquid level, and fill percentage based on configured vessel height and offset parameters.

Default Publish Topic
{device}/HCSR04/Data
Default Metric
HCSR04
{
  "sensorType": "HCSR04",
  "location": "Lab 1",
  "manufacturer": "Autosense",
  "metric": "HCSR04",
  "rawJson": {
    "distance": { "value": 9.2, "unit": "cm" },
    "level": { "value": 6.8, "unit": "cm" },
    "fill": { "value": 54.4, "unit": "%" },
    "duration": { "value": 535, "unit": "us" }
  },
  "mac": "24:6F:28:AA:BB:CC"
}

Mosquitto & Broker ACL Patterns

If your broker runs with authentication or Access Control Lists (ACLs), ensure your subscriber dashboards and AutoSense nodes are granted the following permission patterns:

Dashboard Subscriptions (Read)
              
                autosense/+/status
autosense/+/capabilities
autosense/+/calibration/+/reading
autosense/+/calibration/+/result
                {device_name}/#
              
            
Dashboard Commands (Write)
autosense/+/cmd/#
AutoSense Node: Home Assistant Discovery (Write)
homeassistant/+/autosense_{mac}/#