An MQTT event can tell you something useful: a device publishes that it came online, a sensor reports a state change, or a monitoring service sends an offline notice. But it's easy to read too much into one message. A message received at 09:14 tells you that a particular payload was exchanged between a client and the broker. On its own, it doesn't tell you when the physical device changed state, how long it was unavailable, or whether every earlier message arrived.
That distinction matters when an automation sends a notification or a dashboard changes state. The goal is to keep enough facts to explain what the automation received and decide what to check next. One topic won't give you a complete device history. If you started looking because you don't recognize a device, begin with How to Investigate an Unknown Device on Your Home Network. An unfamiliar label or a single event isn't proof of identity or an intrusion.
An exact record of the received event
Before editing an automation, copy the topic, payload, reception time, and name of the subscriber that saw it. Include the timezone. A useful private note might say: “Home Assistant received home/office/sensor/status, payload offline, at 09:14:03 CET.” Don't add an explanation such as “the sensor failed at 09:14” unless another source establishes that.
Keep the message representation intact. MQTT payloads are bytes; a publisher may send plain text, JSON, a number, or an empty retained clearing message. offline, false, { "status": "offline" }, and an absent message are different conditions. A template or filter that accepts one may correctly ignore the others.
If the payload has its own timestamp, record it separately from the time the broker or subscriber received it. Device clocks can be wrong. Queues can delay a message, and a payload may carry a time from an earlier observation. Compare the two times as evidence; a difference doesn't prove that either is wrong.
Review raw topics and payloads before putting them in a support request. They can reveal room names, account-like identifiers, addresses, or operational details. Replace only the sensitive parts, keeping the structure needed to explain the issue.
The topic's intended meaning
The publisher chooses the topic names. A path ending in status, availability, event, or state gives you a clue, but the protocol doesn't guarantee what it means. Read the integration or device documentation that defines the topic before interpreting an event. An availability topic might report the connection between a client and its MQTT broker. It doesn't necessarily tell you whether the device can reach the rest of the home network or do its intended job.
Keep these three common kinds of observation separate:
- A state message says what the publisher currently reports.
- An event message describes something the publisher says happened.
- A Last Will message is published by the broker, commonly after an unexpected client disconnect, subject to the configured session and connection behavior. MQTT 5 also permits a client to request Will publication when disconnecting with reason code
0x04.
They can be related, but they aren't interchangeable. A retained online state after a broker restart might be an older retained value. Receiving a Last Will alone doesn't prove a connection failure, because the client may have requested it when disconnecting. If a failure occurred, it can't tell you why: power loss, Wi-Fi loss, process exit, or an interrupted route can produce similar results.
When Home Assistant creates an entity through MQTT discovery, the entity's state and availability configuration determine which topics it subscribes to and how it represents them. Check that configuration and the entity's attributes before changing an automation. The visible entity state is useful for an automation, though it may come from more than one message.
Retained messages and timing
MQTT lets a broker retain the latest message for a topic and send it to a new subscriber. This is useful for state: the subscriber gets the last stored value without waiting for a change. But “received just now” can describe a new subscription rather than a new device action.
Check whether the message was retained using a client or broker view you're authorized to inspect. The question is specific: did the subscriber receive a current publication or a value the broker had stored? Check the protocol version and subscription options before interpreting the retained flag: with MQTT 5's Retain As Published enabled, a live forwarded publication can also carry RETAIN=1. The flag alone doesn't establish replay or message age. Don't clear a retained message just to make a dashboard look current. That changes the evidence and may trigger automations that depend on it.
Quality of Service is another delivery setting. It doesn't guarantee a timeline. QoS 0 can lose a message during a disruption, while QoS 1 can deliver a message more than once. QoS 2 adds a more involved exchange. The selected level describes how the protocol handles delivery between client and broker. It doesn't confirm that an application processed the message once, an automation ran once, or the device changed state once.
If you're investigating duplicate events, compare the topic, payload, reception timestamps, retained flag, and any message or event identifier the publisher supplies. Then check the automation trace for each run. Two notifications don't necessarily mean two outages.
One independent signal for comparison
Pick one independent observation you're authorized to make that's relevant to the claim. For a device that reported offline, you might check its documented local administration page, a known service on the same network, or the router's association view. For a sensor event, you could check a physical indicator or take a separate measurement. Record the result and time in the same private note.
Don't expect the independent signal to agree every time. A router can keep a lease after the client is gone. A sleeping device can be absent from a scan, and a firewall can reject an ICMP echo while an allowed service still works. The discrepancy often tells you more than forcing a conclusion would. For a careful way to compare the local address evidence behind that observation, see How to See Every Device on Your Network and Find Its IP Address.
Use the same network path when you repeat the check. A computer on a guest SSID, VPN, VLAN, or different subnet can get a different result from the Home Assistant host. Record the path you used instead of saying the device was reachable or unreachable from everywhere.
The automation as a separate system
An MQTT trigger reaching Home Assistant is one fact. An action producing a notification is another. Open the trace for the relevant run and compare its trigger data with the topic, payload, and time you recorded. Find the first condition, choose block, template, service call, or error that changes the expected path. Read the trace instead of repeatedly publishing test messages until something happens to look right.
For a controlled test, use a clearly fictional topic and payload in a test-only automation you administer. Don't simulate an outage by disconnecting a camera, alarm, NAS, or other important device. A test should establish one narrow result, such as “this exact JSON payload passes this template and creates a persistent notification.” That doesn't prove the production publisher will always send the same form.
Home Assistant may restart, reload an integration, or reconnect to the broker. Note those events when you know about them. They can explain a new subscription or a retained value being delivered again. Record them as context rather than quietly treating them as part of the device's timeline.
A small evidence table
A short table helps keep a useful event from turning into a story reconstructed from memory. Keep it private and include only the observations you need:
Fictional example:
| Time and timezone | Source | Exact observation | What it does not establish |
|---|---|---|---|
| 09:14:03 CET | MQTT subscriber | offline received on the availability topic | physical cause or start time of an outage |
| 09:14:08 CET | Home Assistant trace | automation stopped at a condition | why the publisher sent the event |
| 09:15:00 CET | authorized service check | service did not respond from this client | reachability from every network |
DeviceShelf is one possible local record for comparing observed devices and changes over time. Treat it, a router view, an MQTT event, and an application check as separate sources of evidence. None alone proves a device's identity, complete history, or a security incident.
Let the limited fact you have guide the next check. For a retained state, check the publisher and subscription behavior. If a trace stops at a condition, check that condition against the exact payload. If an independent check finds a service unreachable, troubleshoot that service or network path. Keeping those questions separate makes later evidence easier to interpret.
