MQTT topic (mqtt_topic)
Connects to an MQTT broker, subscribes to a topic and reads the first message that arrives. It reports whether a message arrived in time, how long that took, whether the broker delivered it from its store (a retained message) or because someone had just published it, the number in it, and how old it is when the payload says when it was made. Each of these can be held to limits like any channel.
Use it for the values that devices publish: a temperature, a counter, a heartbeat, a status that is a number or a word you map to one. A device that stops publishing shows as no message, or as a message that grows old.
What it looks like

The sensor's page after a few polls, reading a number from a topic over TLS with a login. In the dark theme: the sensor's page. The form for adding it, with its parameters filled in: light, dark.
Channels
| Key | Name | Unit | Default limits |
|---|---|---|---|
connect_ms | Connect time | ms | warning above 1000, error above 5000 |
message_received | Message received | none | error below 1 (0 is No message, 1 is Received) |
message_wait_ms | Time to the message | ms | none; unknown when no message arrived |
value | Value | by value_unit | none; unknown when the payload has no number |
age_s | Age of the message | s | none; only with age_path or age_from_payload |
retained | Retained message | none | none (0 is Live, 1 is Retained) |
cert_days_remaining | Days until the certificate expires | days | warning below 21, error below 7; only over TLS |
chain_days_remaining | Days until the earliest expiry in the chain | days | warning below 21, error below 7; only over TLS |
Set limits on value and age_s on the sensor itself, since what is normal depends on what the topic carries; for a heartbeat, an error above a few multiples of its period on age_s is the usual check. The name and unit of value come from value_name and value_unit.
No message is not a failed poll. The broker answered and nothing came in wait_ms, so the sensor is Down with message_received 0 and the message names the topic and the wait. A failed poll is reserved for a broker that could not be reached or refused the sensor.
Parameters
| Parameter | Default | Meaning |
|---|---|---|
topic | required | The topic or topic filter to subscribe to: + stands for one level, a final # for the rest (plant/+/temp, plant/#). The first message that arrives is the one read. |
wait_ms | 3000 | How long to wait for a message after the subscription is confirmed, 100 to 60000. Never longer than the poll's timeout. |
skip_retained | false | Ignore a message the broker keeps and delivers at once on subscribing, and wait for one published afterwards. Use it when the retained message of a dead device would otherwise hide the silence. |
value_path | none | Where the number is when the payload is JSON: a JSON Pointer (/sensor/temp) or a simple path (sensor.temp, readings[0]). Without it the payload itself is read as a number (21.5), and value is left unknown when it is not one. With a path, a payload that is not JSON, a missing path or a value that is not a number makes the sensor Down. A text number ("21.5") and a boolean are accepted. |
scale | 1 | Multiply the number by this. |
value_name, value_unit | Value, none | The name and unit shown for value. |
age_path | none | Where the time the message was made is, when the payload is JSON, as a path like value_path. A number is Unix time in seconds, or in milliseconds from 100 billion on; text is read as RFC 3339 (2026-11-30T10:15:00Z). age_s is the probe's clock minus that time, so a device whose clock runs ahead gives a negative age. |
age_from_payload | false | The payload itself is the time, in the same formats. Not together with age_path. |
port, security, authenticate, allow_plaintext_login, server_name, verify_tls, tls_fingerprint, check_certificate | as for the broker sensor | The connection. |
Suggested interval: 60 seconds. Credential: optional login. The login and the certificate rules are those of the MQTT broker sensor: the login is sent only with authenticate, and a sensor that would send the password without TLS is refused unless allow_plaintext_login is set.
Only the first message is read, and at most 64 KiB of its payload. A message larger than a megabyte fails the poll with a message that says so. The subscription is at QoS 0 and the connection lasts only for the check, so nothing is left at the broker.
On the target
An MQTT broker (3.1.1 or 5) reachable from the probe, and an account that may subscribe to the topic when the broker requires logins. Nothing is installed, and nothing is changed: the sensor only subscribes.
A topic that is published often is read the moment the subscription is confirmed. One that is published once a minute needs wait_ms above that, which in turn needs a timeout in the sensor's settings above it; a retained message is the simpler way to monitor a slow device, together with age_path to see how old it is.
Failures
| Message | Meaning |
|---|---|
the broker refused the login, not authorised (kind auth_failed) | As for the broker sensor. |
the broker refused the subscription to "..." (kind auth_failed) | The account may not read this topic. |
TLS error: ... (kind protocol) | The certificate was refused, or the port does not speak TLS. |
a timeout (kind timeout), connection refused (kind unreachable) | The broker did not answer, or nothing listens on the port. |
no message on "..." within ... ms | A successful poll that is Down. |
the payload is not JSON, <path> is not in the payload, <path> is not a number, <path> is not a time | A successful poll that is Down: the message arrived but is not what the sensor was told to expect. |
Verification
Run against Mosquitto in a container on a lab network, with a login, over TLS: a retained topic with a number, a scale, a wildcard filter, the wait for a live message with retained ones skipped (and the Down it ends in), a topic that nobody publishes to, a login refused, and the certificate checks of the broker sensor. The packets, the retained and live messages and the refusals are also tested against a broker written for the tests. The sensor's own rules (JSON paths, scale, the formats of a time, the age, every way a payload can fail to hold what was asked) are tested against scripted answers.
Not seen: payloads other than text and JSON, a topic with a very high message rate, MQTT 5 properties, a broker other than Mosquitto.
The live tests use the variables of the broker sensor:
cargo test -p probeward-sensors --test industrial_live mqtt -- --nocapture