What do I need to generate a network map

my network has a CC2531 Coordinator (firmware 20190608) with zigbee2mqtt 1.5.1
I haven’t found any guide or manual on how to do it without home assistant or openhab

I have read https://www.zigbee2mqtt.io/information/mqtt_topics_and_message_structure.html and https://github.com/Koenkk/zigbee2mqtt/issues/417

but i don’t know how to publish the new topic zigbee2mqtt/bridge/networkmap/graphviz

thanks

I have already understood:
publish: mosquitto_pub -t zigbee2mqtt/bridge/networkmap -m graphviz
at the same time subscribe: mosquitto_sub -t zigbee2mqtt/bridge/networkmap/graphviz
it is right?

It’s correct.
I would suggest you to use mqtt explorer http://mqtt-explorer.com/. Using this app is a lot easier to publish/subscribe to topics. Highly recommended.

Gab

Thanks Gab
I have made a little script that shows de networkmap in one step

#!/bin/bash
# additional dependencies: graphviz imagemagick

# put temporal files in ram filesystem
file="/dev/shm/networkmap"
fechahora=$(date '+%F-%H:%M')
#~ echo $fechahora

mosquitto_sub -t zigbee2mqtt/bridge/networkmap/graphviz -C 1 >${file}.dot &
mosquitto_pub -t zigbee2mqtt/bridge/networkmap -m graphviz

# wait until mosquitto_sub ends
wait

# generate graphic with graphviz (change to short texts with sed)
cat ${file}.dot|sed -e 's/Xiaomi Aqara temperature, humidity and pressure sensor/AqaraTHP/g'|sed -e 's/Xiaomi Mi\/Aqara smart home cube/AqaraCube/g'|sed -e 's/Xiaomi Aqara double key wireless wall switch/AqaraDoubleSwitch/g'|dot -Tsvg  > ${file}${fechahora}.svg

# display with imageMagick command
display ${file}${fechahora}.svg &

Nice! Thanks for sharing!

Hi, could someone share exactly how to do this with MQTT Explorer on Windows 10?

Okay say that I might not be on a recent enough version so have upgraded to version 1.7.1

I am trying to post this topic but get no response and the zigbee2mqtt log shows nothing…

zigbee2mqtt/bridge/networkmap

Do I need to send any sort of payload?

payload is either raw or graphviz

1 Like

I’ve been playing with Melonius’ script and here’s my version.

I find it a little easier to read thanks to using neato as the layout engine.
Dot kept laying everything in parallel, making it hard to see.

The other bits just make tweakage easier. I’m posting this as the dot manpage isn’t the clearest about how to use things and hopefully the flags will help people understand it

#!/bin/bash
# additional dependencies: graphviz imagemagick

# put temporal files in ram filesystem
file="/dev/shm/networkmap"
fechahora=$(date '+%F-%H:%M')
ROOT="0x000000000"  # put your coordinator here
mqtthost="127.0.0.1" # change if your mosquitto is on another host
user="mqtt-username"
pass="mqtt-password"
#~ echo $fechahora

mosquitto_sub -h $mqtthost -u $user -P $pass -t zigbee2mqtt/bridge/networkmap/graphviz -C 1 >${file}routes.dot &
mosquitto_pub -h $mqtthost -u $user -P $pass -t zigbee2mqtt/bridge/networkmap/routes -m graphviz

# wait until mosquitto_sub ends
wait

# generate graphic with graphviz (change to short texts with sed)
cat ${file}routes.dot|sed -e 's/Xiaomi Aqara temperature, humidity and pressure sensor/AqaraTHP/g'|sed -e 's/Xiaomi Mi\/Aqara smart home cube/AqaraCube/g'|sed -e 's/Xiaomi Aqara double key wireless wall switch/AqaraDoubleSwitch/g'|\
   dot -Kneato -Groot=$ROOT -Goverlap=false -Gnodesep=1 -Granksep=1 -Tsvg > ${file}${fechahora}routes.svg

# display with imageMagick command
display ${file}${fechahora}routes.svg &

Can someone please help me understand how this can be accomplished without the Mosquitto broker on Windows. I am using mcsMQTT with Homeseer and have successfully set up a handful of devices and a couple of routers. I am almost smart enough to be dangerous with MQTT Explorer.

From the above I see I need to subscribe to “zigbee2mqtt/bridge/networkmap/graphviz” but don’t understand what or why the extension “-C 1 >${file}routes.dot &” is added [I am guessing it is to save the routes to the file location stated as file="/dev/shm/networkmap" [don’t understand the relevance of that path]

I haven’t used Linux or Misquitto so I am not sure what is associated with what, and even if I did, I don’t think I could create the equivalent for windows.

My limited understanding is I need to subscribe and publish the above zigbee2mqtt commands but my subscribed data needs to be stored somewhere so I can paste it into graphviz. Not sure how to accomplish that using MQTT Explorer

Any help would be greatly appreciated!

@CarlZig: you would want to either subscribe to subscribe to zigbee2mqtt/bridge/networkmap/graphviz and send the graphviz payload to zigbee2mqtt/bridge/networkmap, or just look at the Zigbee2MQTT logs which will show the output as well. You can then copy paste that into Web GraphViz to produce the graph.

You are right the -C 1 >${file}routes.dot & command is there to write the output to a file, but copy/pasting works just as well.

@ndfred Thanks for the response and sorry for such a basic question, but with my setup I do not code any publications or subscriptions. The Homeseer plugin I use handles all the subscription information I want to manage from the devices. I use MQTT Explorer to monitor specific traffic. My issue is that I do not know how to use MQTT Explorer for this situation or the specific text to use with a command prompt that would send the payload to zigbee2mqtt/bridge/networkmap.

I tried to use the advanced section of MQTT Explorer to add the subscription zigbee2mqtt/bridge/networkmap/graphviz I then published zigbee2mqtt/bridge/networkmap/routes -m graphviz as was stated above by others. After I published this zigbee2mqtt/bridge/networkmap/routes -m graphviz showed up in Explorer, but no data was created or was there any new data in C:\Zigbee2mqtt\data\log

Any specifics you or anyone could share with me would be appreciated.

Thanks stoatwblr,
neato significantly improves the map display

Hi CarlZig, I am using Homeseer and made this device with mcsMQTT:


At the end fill in graphviz at Publish payload Template. (I can only upload 1 image, because I am new here)
Choose SHOW_VALUES at HS Device MISC Properties.
When you activate the device, the data is in between in mcsMQTT

Peter,
Thanks for information. I have also worked through a way to use MQTT Explorer. I am finding it very useful, unfortunately I can not find any help files so I have just stumbled along. So I had already subscribed and published the graphiz data, but was only able to get one map per boot. I hadn’t realized that it had populated in mcsmqtt until I saw your post and tried to follow along.

I am not sure how you created a device in HS that you could link to mcsmqtt (I only thought you it went from mcsmqtt to HS). So how did you create your device?

When I went poking around in mcsmqtt I saw it was already created from my MQTT Explorer experiments. That is also why I think I could only generate one map, mcsmqtt has a “clear” button under the data and when it would fill I think it limits map generation before perform a clear (I need to test this theory). I was going to post my Explorer method but have not figured out the one map issue.

I accidently figured out how to create historical charts very easily in Explorer. I wanted to track how often my Aqara temp sensor reported

Thanks,
Carl

You can create a device when you go to mcsMQTT and select edit/add. When you change the sub, a new device is created.

if it seems good to you we continue the forum in What do I need to generate a network map · Discussion #7438 · Koenkk/zigbee2mqtt · GitHub