Graph your Z-Wave mesh (Python, auto-update)

No, the API defaults to port 8123. If you need 443 you can specify it in the base_url.

There are two different pieces that have URLs. The one you define above is used by HA to route the iframe request to the HTML that serves the graph. The base_url setting in the http: section is used by the Python script to know how to connect to the API, so it can write the json that is graphed by the html piece in the iframe.

Yeah, I guess I should have realized thatā€¦ :frowning:
My base url is : base_url: my.domain.com

I just pushed a version that uses 1 / averageRequestRTT for the width of the edges. Faster nodes will show as thicker lines, while slow nodes can go as thin as a single pixel. In general this looks reasonable for my mesh network. My 1st layer devices are significantly faster than my 2nd, and my battery powered devices are pretty slow. I was torn between averageRequestRTT and averageResponseRTT. I couldnā€™t find any documentation on the differences, but I suspect Response includes the time waiting for a battery powered device to wake up.

As you mouse-over the edges, keep in mind that the numbers are for the entire traversal of the network, not just the individual paths. This means every edge from a node in layer 3 to every node it connects to in layer 2 has the same value.

Thatā€™s pretty sweet.

The differences below 100 are reasonably obvious, but above thatā€¦ not so much:

If you look at the top row, two have RTTs under 200, two under 1000, and one over that.The red line on the left (Bear <> Table) is for an RTT of 140. The orange one coming down from Table is 311.

Oh, and the really thin ones, those are for an RTT of zero (Iā€™m guessing no data).

Given that the RTT is milliseconds, anything over 500 is ā€œnot goodā€ (half a second), and anything over 1000 is bad news (over a second). Even zoomed in the difference between 160 and 1400 is, well, there is none.

I pretty much have to agree. It just doesnā€™t add anything. I tried a version with the edge width based on the tiers of time as you mentioned, but I donā€™t really think that adds anything either. It just gets too messy.

One thing Iā€™ve tested locally is to put the RTT in () under the node name, which seems decent. Iā€™ve also sorted the nodes by name so the list is alphabeticallyā€¦

Hmm, I wonder how it would look sorted by most-to-least number of connections? The left would be really messy and the right would be mostly empty, so maybe not an improvement.

Still tinkering locally, but I donā€™t have any major changes in mind.

OK, so for the docker folks, this by default does not workā€¦
BUT, i have finally gotten to the solution by adding:

sys.path.append('/usr/src/app')

The header now looks like this:

#! /usr/bin/env python3

import argparse
import datetime
import json
import os.path
import sys
sys.path.append('/usr/src/app')

This is the link to the discussion:

Additionally, you will need to change the link in the script to point to the correct dir for python3

z_wave_graph: /usr/local/bin/python3 /config/<YOUR-PATH>/z-wave-graph.py <--ssl --port 443 (if https)>

ENJOY!

Awesome detective work, thank you! Iā€™ve pushed a new version that has the sys.path.append() part and mentions the shell_command change in the README.

1 Like

Finally got around to giving this a shot. Awesome! Installation was a little hairy, but I got it worked out.

The RTT stats are quite interesting to see, especially the difference between 1-hop and 2-hop devices.

Iā€™m getting an error if I run the script from shell, any ideas?

"PermissionError: [Errno 13] Permission denied: ā€˜/home/homeassistant/.homeassistant/www/z-wave-graph.jsonā€™
"
image

www/ or at least that www/z-wave-graph.json needs to be writable by the user that runs the script. You can create the file and set permissions appropriately if you donā€™t want to change the permissions on the directory.

:+1:Needed write permission to the www directory.

It runs from within the shell manually, but not from the automation, any ideas?

Any error messages? Is HA running in Docker? If so, see the README for an updated from yesterday.

No errorā€™s in log, running Hassbian.

Are you running HA as root?

I asume so, not sure

How do you start it?

HA auto starts on boot or, ā€œsudo systemctl start [email protected]ā€

What does /etc/systemd/system/[email protected] say?

Does it contain the line

user=%i

If so, you are running HA as user homeassistant, but /home/homeassistant/.homeassistant/www is owned by root.

You probably want to do:

sudo chown -R homeassistant /home/homeassistant/.homeassistant
sudo chgrp -R homeassistant /home/homeassistant/.homeassistant

to get everything under your config directory changed to ownership (and group, but not as critical) by the user that runs HA.