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

I’ve created a custom component you can use to make sure networkx is installed. I find this to be a much cleaner solution when using docker, no more messing around inside containers now! :smiley:

Create z_wave_graph.py containing the following code in your custom_components directory and load it using z_wave_graph: in your main configuration.

DOMAIN = 'z_wave_graph'
REQUIREMENTS = ['networkx']

def setup(hass, config):
   return True
1 Like

This script doesn’t work anymore on HA 0.77 and up … I get the following error:

# /usr/local/bin/python3 /config/bin/z-wave-graph.py Traceback (most recent call last): File "/config/bin/z-wave-graph.py", line 36, in <module> import homeassistant.remote as remote ModuleNotFoundError: No module named 'homeassistant.remote'

you have to re-add in remote.py as a workaround.

Can you please tell how can I change the default value of nodeDistane ? Every time I refresh the page it is 120. I tried to change the value in html file with no result. Can you give me a hint ?

I’ve been out of the forums for a long while, just seeing this now. You might have caching issues. I had to load the Chrome dev tools, go to the Network tab, make sure “Disable cache” is selected, then reload (with the dev tools still open). Otherwise you get the previously cached version again. I /think/ that restarting Hass works too, but who wants to do that. :slight_smile:

Can you expand on what you mean? I’m running into the same issue.

HA 0.77 version no longer includes remote.py. It was deprecated in this version and is no longer supported. You can however grab it from a previous release and load it into any future versions. I did that and the graph works again.

I still haven’t upgraded to 0.77. A new 3D printer has been eating up all my free time, but it’s on my list for … soonish. Then I’ll get it all ironed out.

Okay, new version up on GitHub that uses the REST API as required by 0.77+. Please test and let me know how it works for y’all.

Anyone test this new version yet? I have it on my list but need to finish a few things first.

I see two python files. One in /bin and the other is in custom_components in your repo. Which one is the latest? I assume the one in /bin but you have a commit message saying its not necessary?

custom_components is used to install requirements - specifically targeted at those using Docker.

That’s not just for targeting Docker users. If you look at that file, it hasn’t been modified in a month. It is unclear which file should be used. I assume the one in /bin, but I’m not just going to assume. I prefer confirmation :slight_smile:

I am running the bin version - the other .py file is 5 lines and only used to install dependencies.

see here for confirmation: https://github.com/OmenWild/home-assistant-z-wave-graph/pull/9

ah yes, I should have looked at the file deeper. TY for pointing that out sir!

Correct, the one in bin/ is the one that actually talks to HA and does the work of creating the JSON that gets converted to a graph. The commit message was noting that I had left in a reference to localhost instead of using the correct URL to pull the data from the new REST API.

If you had a working install before 0.77 then updating the file in bin/ should be enough to get you working again.

I’m having an issue running this, which I think is caused by not having python3 installed, but I don’t know how that’s possible.

When I run “which python” it returns “/usr/bin/python”.

However when I run “which python3” it returns “python3 not found”

When I look in /usr/bin/ I see “python”, “python2”, and “python2.7” and nothing else python related.

I’m running hassio inside a ubuntu machine. I don’t see any notes on installing this that include python3 as a requirement or talk about having to install it.

If i remove the “3” and have the shell command run it from /usr/bin/python, it errors and in the log shows it exited with “return code: 127”

What am I doing wrong?

Could th style be a bit more …let’s say … beautiful?:grin: Good work

Not sure what’s going wrong. I’m on .79.3 and can no longer get this to work.

Here are the errors after running it.

Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/bin/z-wave-graph.py", line 332, in <module>
    zwave = ZWave(config, args)
  File "/home/homeassistant/.homeassistant/bin/z-wave-graph.py", line 195, in __init__
    self.get_entities()
  File "/home/homeassistant/.homeassistant/bin/z-wave-graph.py", line 238, in get_entities
    self.add(entity['attributes'])
  File "/home/homeassistant/.homeassistant/bin/z-wave-graph.py", line 231, in add
    return self.nodes.add(node)
  File "/home/homeassistant/.homeassistant/bin/z-wave-graph.py", line 122, in add
    node = Node(attrs)
  File "/home/homeassistant/.homeassistant/bin/z-wave-graph.py", line 54, in __init__
    if 'primaryController' in self.capabilities:
TypeError: argument of type 'NoneType' is not iterable

Let me know what else I can post to see what might be going on.

I’m still on 0.78.0, haven’t quite had the time to upgrade and work out the issues. I suspect it has something to do with the auth changes. Hopefully soon(ish) I can find some time to upgrade and work out the issues.

Very possible. I have API Password still enabled. But I’ll sit and wait patiently. Thanks so much for creating this!