Zigbee2MQTT connects a Zigbee network to an MQTT broker. Home Assistant normally discovers the entities for you, but Node-RED, openHAB and scripts need to know the actual topics and supported payloads. The same map helps when a command or state update is missing.
This guide follows Zigbee2MQTT 2.14.2: device state, SET/GET, availability, bridge APIs and the three output formats. The examples are illustrative. No device was commanded or paired for this article, and a message displayed on MQTT is not by itself proof of physical execution.
The topic model
The default base topic is zigbee2mqtt, configured under mqtt.base_topic. A device’s friendly name follows it; by default that name is its IEEE identity. Renaming changes the publication/command path and requires checking clients that use the old topic.
Examples use living_room_light. Use your actual broker, base topic and exact friendly name, including any slash structure. Authentication, TLS and topic permissions must already allow the relevant client to publish or subscribe.
zigbee2mqtt/living_room_light <- state published by Zigbee2MQTT zigbee2mqtt/living_room_light/set <- supported control request zigbee2mqtt/living_room_light/get <- supported read request zigbee2mqtt/living_room_light/availability <- communication assessment, when enabled
The topic reference describes these paths. Their existence does not mean every device supports SET, GET or availability in your configuration. Check its selected definition and Exposes access: STATE is published information, SET is writable support, and GET is a read path.
Reading state on the device topic
With the default JSON output, Zigbee2MQTT publishes a payload on the plain device topic. It can originate from a report, poll/read response, cached replay or optimistic command result. With cache_state enabled, unchanged cached fields are merged into new publications, so all fields in one newly received message need not have been measured together.
{"state":"ON","brightness":180,"linkquality":96}
linkquality is a radio diagnostic, not a command-execution receipt or a percentage of overall network reliability. A receiver-side last-hop reading may involve a router. Confirm a fresh relevant device report and the physical result when that distinction matters.
The per-device retain option defaults to false. A later subscriber may therefore wait for the next publication unless the broker still has an older retained copy or another refresh/cache path supplies data. An empty MQTT Explorer view alone does not diagnose a failed pairing.
Retain stores a last-known payload for later subscribers, subject to broker expiry and persistence. It does not mark the payload fresh, and a new non-retained publication does not remove an old retained copy. The retain/state.json guide covers those separate replay paths.
SET commands and supported properties
Publish supported writable properties as JSON to zigbee2mqtt/FRIENDLY_NAME/set. A dimmable light may accept state and brightness; a plug can also have model-specific memory, lock or other settings. Do not assume every plug accepts only state or that every exposed diagnostic is writable.
{"state":"ON","brightness":180}
For a single property, .../set/state with bare ON is a documented shorthand. Endpoint-suffixed properties and mapped endpoint topics have additional routing rules; use the exact model’s names. Do not retain command publications, because replaying a past command is different from replaying reported state.
The released handler selects a matching toZigbee converter and its SET function. The Exposes access list is the supported public guide, but the handler does not simply reject everything absent from Exposes before looking up a converter. A custom or internal command can have different declarations. Missing keys or SET functions, invalid values, unknown devices/endpoints and radio errors can all fail at different stages.
No converter available is a logged error for a missing converter/operation, not evidence that every radio problem has that cause. The device SET path has no general correlated success/error response topic for each command. Inspect local/frontend logs and the configured bridge/logging stream, then check a fresh state report and the physical result. MQTT publication success alone does not establish device execution.
GET requests and waking devices
For a property with a supported GET path, publish its name with an empty string value to the device’s /get topic. This example asks a compatible light for its switch state:
{"state":""}
Subscribe to the expected state output before sending the request. A successful converter read normally results in a state publication when the device responds; attribute output changes where those values appear. It is not a universal read of every field, a guaranteed response time or a separate snapshot of the whole device.
An awake radio and supported read operation matter more than the power source alone. Mains devices commonly remain reachable; sleepy devices can need their documented wake sequence and may defer or reject a read. Some battery products do support reads while awake. A report-only field does not gain a GET path merely because you send its name.
Read failures can be logged as a missing converter/function, timeout or device error. Keep that distinction separate from cached state: a value already displayed before your request does not show that the read succeeded.
Device availability
When enabled for a device, availability publishes a communication-based online/offline assessment on its /availability topic. This is an illustrative payload:
{"state":"online"}
Current availability publications request retain and QoS 1. The global mqtt.force_disable_retain override can remove retain even here, and old broker-retained copies can outlive a later configuration change. Zigbee2MQTT 2.0 removed legacy_availability_payload, as listed in the breaking changes; current device availability uses JSON rather than the old plain online/offline strings.
Active devices normally check in within ten minutes and can be pinged on timeout; passive devices have a default 25-hour check-in timeout. Current configuration allows different timeouts, jitter and backoff. The last_seen history and enabled availability rules, not the age of a retained state field alone, drive the assessment.
Availability can change without a new measurement on the state topic. A device marked online can still fail a particular command; an offline device can still have an old ON reading in a subscriber’s cache. Read the bridge and device paths together when building a raw MQTT dashboard.
Bridge information, events and request/response APIs
bridge/state describes Zigbee2MQTT’s MQTT connection: current JSON online on initial connection/reconnect, offline on normal shutdown, with a configured will for unexpected disconnection. It normally requests retain. That bridge status is separate from the availability of each end device.
bridge/devices, bridge/groups and bridge/info normally request retain for metadata snapshots. Devices include reported endpoints, selected definition and interview/support information; groups include members and scenes. These snapshots are useful for integration setup, not a fresh reading of every physical device.
bridge/event emits lifecycle events such as joins and interviews. bridge/logging carries configured log output. Those streams are not retained metadata snapshots, and debug/log-level/filter settings affect what you see. Inspect the running log configuration before expecting every local log line to appear over MQTT.
{"type":"device_joined","data":{"friendly_name":"0x00124b00xxxxxxxx","ieee_address":"0x00124b00xxxxxxxx"}}
Bridge administration has an application request/response API, unlike the device SET/GET path described above. For example, a request on bridge/request/permit_join receives a result on bridge/response/permit_join. Subscribe first, use the exact documented payload and a unique transaction identifier, then check the matching status and any returned data/errors. MQTT is capable of application request/response; this site’s topic map should not be read as a protocol-level prohibition.
Do not expose unrestricted bridge command access to an untrusted client. A broker connection and subscription are separate from authorization to change the network. This guide describes topic behavior, not a complete broker security configuration.
JSON, attribute and combined output
The current setting is advanced.output. It selects json, attribute or attribute_and_json for entity state publication. It does not turn every bridge/availability topic into that format. Merge this example into your existing advanced section:
advanced: output: attribute_and_json
| Mode | Entity state publications | Consumer considerations |
|---|---|---|
| json, default | Combined JSON on the device/group topic | Use for Home Assistant discovery and consumers that parse JSON. |
| attribute | Separate property topics | Useful for consumers expecting individual values; incompatible with the current Home Assistant extension alone. |
| attribute_and_json | Both JSON and property publications | Supports mixed consumers, with more messages. JSON remains available for Home Assistant. |
For simple values, attribute output puts ON on .../state and 180 on .../brightness. The implementation also has encoding rules: arrays become comma-separated values, nested objects recurse into hyphen-joined property names, null/undefined values produce empty payloads, and RGB color has a special array conversion. Do not treat all values as unchanged JSON fragments.
The settings reference and released controller establish those formats. The Home Assistant extension rejects attribute-only output because it needs JSON state. Keep cache_state: true for its normal integration behavior. JSON or combined output is the appropriate choice when Home Assistant and another consumer share the instance.
Node-RED and openHAB can also parse JSON; splitting attributes is a choice for a specific consumer rather than a requirement imposed by their names. Combined output can help a migration, but it is not automatically the lowest-traffic or safest default. The debounce/throttle guide covers separate publication-rate choices. MQTT Explorer can inspect any mode; match the expected topic before deciding that data is missing.
FAQ
Where do I send a control? To the actual device SET topic using a supported writable property and valid value. Check logs and the physical result.
Why did SET fail? Check broker/topic permissions, device/endpoint identity, converter key/function, values and radio error. A missing converter is one diagnosis rather than a proven most-common cause.
Are state messages retained? Per-device retain defaults to false. Bridge metadata and availability normally request retain, while event/log streams do not; the global force-disable option applies to outgoing retain flags.
Where is output format configured? Under advanced.output. JSON is the default, attribute splits values, and combined emits both. Attribute-only does not support the current Home Assistant extension.
How do I check online status? Observe enabled device availability and bridge state, then check a fresh report or command when needed. Neither an old retained ON state nor online availability guarantees every function works.
What is bridge/devices for? It is the retained-by-default device metadata snapshot used by clients, with identities, endpoint/definition and interview information. It is not a bench test or a physical-state query.
Sources and checks
Topics, command routing, formats and state merging were checked in the 2.14.2 publish handler, controller, MQTT and availability implementations, alongside the official references. All payloads here are examples, not captured hardware results.
A local coordinator, instance and broker can provide these exchanges without a device vendor’s cloud. A remotely hosted broker, automation target or other service can add network dependencies. Confirm the exact installed definition, access flags and output configuration before building a client around the example topic.
