MQTT API
Zigbee Hub mode has the ability to connect to local or remote MQTT brokers. Currently only TCP connections are supported.
Topics are divided into IN and OUT.
IN - you can send messages to these topics.
OUT - Zigbee Hub sends messages to these topics.
Topics format
Data topic (OUT)
General data topic format below:base topic / data / zigbee device ieee / zigbee endpoint / zigbee cluster / zigbee attribute
base topic - global prefix, so you can have few Zigbee Hubs connected to one broker, you just have to set different base topics.data - static text (topic type)zigbee device ieee - sender IEEE address in HEX format.zigbee endpoint - zigbee endpoint from which this message is coming, DEC format.zigbee cluster - zigbee cluster from which this message is coming, HEX format.zigbee attribute - zigbee attribute from which this message is coming, HEX format.
Data topic example: zhub/data/a4c1383439bf5cc9/1/0000/0001
Command topic (IN)
This topic is intended for sending ZCL commands to a Zigbee device.
General cmd topic format below:base topic / cmd / zigbee device ieee / zigbee endpoint / zigbee cluster / zigbee command
base topic - global prefix, so you can have few Zigbee Hubs connected to one broker, you just have to set different base topics.cmd - static text (topic type)zigbee device ieee - target zigbee device IEEE address in HEX format.zigbee endpoint - target zigbee device endpoint to which this message is coming, DEC format.zigbee cluster - target zigbee device cluster to which this message is coming, HEX format.zigbee command - zigbee command to send, HEX format.
Some clusters have special handlers for input commands, such as the ON/OFF or Light cluster. You can find their formats below:
ON/OFF cluster payload format for command topic
ON - send ON commandOFF - send OFF command
Example: zhub/cmd/a4c1383439bf5cc9/1/0006 payload: ON
Will send command to enable relay or light device.
Level control for Light cluster payload format
0000 command payload is a number in DEC from 1 to 254, the larger the number, the brighter the lamp will be.
Color control cluster payload format
0007 command payload is a color in HEX or RGB format. For example: 255,29,0 or #FFFFFF000a command payload is a light temperature in mired. For example: 200
Other clusters
If no built-in clusters or ZCN converters has overridden the processing of this command, if the command contains a payload, it must be a HEX string of the following format:
- Bytes without spaces, uppercase, multiple of two. Example: 010203FF
- Bytes with spaces, uppercase, grouped by two. Example: 01 02 03 FF
Write topic (IN)
This topic is intended for writing ZigBee device ZCL attributes.
General write topic format below:base topic / write / zigbee device ieee / zigbee endpoint / zigbee cluster / zigbee attribute
base topic - global prefix, so you can have few Zigbee Hubs connected to one broker, you just have to set different base topics.write - static text (topic type)zigbee device ieee - target zigbee device IEEE address in HEX format.zigbee endpoint - target zigbee device endpoint to which this message is coming, DEC format.zigbee cluster - target zigbee device cluster to which this message is coming, HEX format.zigbee attribute - target zigbee device attribute to which this message is coming, HEX format.
payload format
