How to create zigbee map in zigbee2mqtt with Home Assistant

Sometimes it is useful to view the information about zigbee network as a picture with devices. It is called zigbee map. There are several way how to create zigbee map with Home Assistant and zigbee2mqtt.

You can install some additional soft. I know about several projects that can create zigbee maps:

But, actually you don't have to install anything in addition to create zigbee map. The map can be generated only with Home Assistant build-in tool and some public service from the internet. To create a map you need Home Assistant to be configured with zigbee2mqtt.

The description

Home Assistant is working with zigbee2mqtt via MQTT server. To get map data from zigbee2mqtt you need to send to MQTT server some special command and then get map data from MQTT server.

This can be done with Home Assistant internal tool.

How to open Home Assistant MQTT tool

The development of Home Assistant is moving very fast. The place where MQTT tool is situated depends of Home Assistant version.

In recent versions you need to open in menu: Configuration -> Integrations -> MQTT Configure

In the previous versions of Home Assistant you need to open Developer Tools -> MQTT.

How to send command to generate zigbee map and to get map data

In the section "Listen to a topic" you need to enter text "zigbee2mqtt/bridge/#" and press the button "START LISTENING". With this action we are asking Home Assistant to show all the updates of MQTT topics that start with "zigbee2mqtt/bridge/". (In the MQTT world the "#" symbols means "everything"). After pressing the button we should see some messages.

After we have configures MQTT to listen to all the desired topics we need to send command to create zigbee map data. To do that we need to enter topic "zigbee2mqtt/bridge/networkmap" in the section "Publish a packet", and enter "graphviz" in the field "Payload", and press "Publish".

After pressing "Publish" we will immediately see the topic that we have just published. In some time there will appear zigbee map data (the time needed to create that data depends of number of devices, the more devices, the more time needed to create a map)

Convert zigbee map data to the image

So, we have got zigbee map data from zigbee2mqtt. But that data is described in some special format called "graphviz". To create image from that data you need to use some special tool. You can use online tool https://dreampuf.github.io/GraphvizOnline/ (this tool is very easy to find in any search engine with the search request "graphviz online").

Next you need to copy map data from Home Assistant to your clipboard and paste it into into the tool. As a result you will get image with zigbee map.

This tool uses "dot" "Engine" to create images, for zigbee map it is better to select "circo" "Engine". With "circo" all the devices are arranged in a circle around the main device.

So, this is the map. When you click on it the .svg file will be downloaded (in the dropdown menu you can select file format)

Ivan Bessarabov
ivan@bessarabov.ru

15 july 2020

This text is also available in Russian language