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

Same result :frowning:

(homeassistant) homeassistant@hass:~/.homeassistant/shell_commands$ cat z-wave-graph.yaml
z_wave_graph: /srv/homeassistant/bin/python3 /home/homeassistant/.homeassistant/bin/z-wave-graph.py
(homeassistant) homeassistant@hass:~/.homeassistant/shell_commands$ date
Tue Feb 13 19:52:18 EST 2018
(homeassistant) homeassistant@hass:~/.homeassistant/shell_commands$ tail -n 8 /home/homeassistant/.homeassistant/home-assistant.log
2018-02-13 19:40:00 ERROR (MainThread) [homeassistant.components.shell_command] Error running command: `/usr/local/bin/python3 /home/homeassistant/.homeassistant/bin/z-wave-graph.py`, return code: 1
NoneType: None
2018-02-13 19:45:00 ERROR (MainThread) [homeassistant.components.shell_command] Error running command: `/usr/local/bin/python3 /home/homeassistant/.homeassistant/bin/z-wave-graph.py`, return code: 1
NoneType: None
2018-02-13 19:48:47 ERROR (MainThread) [homeassistant.components.shell_command] Error running command: `/usr/local/bin/python3 /home/homeassistant/.homeassistant/bin/z-wave-graph.py`, return code: 1
NoneType: None
2018-02-13 19:50:00 ERROR (MainThread) [homeassistant.components.shell_command] Error running command: `/usr/local/bin/python3 /home/homeassistant/.homeassistant/bin/z-wave-graph.py`, return code: 1
NoneType: None
(homeassistant) homeassistant@hass:~/.homeassistant/shell_commands$

This isnā€™t really high priority to me, just weird. Donā€™t feel any obligation to spin too many cycles on it.

The shell_command seems to be about 90% of the issues. Just too many configurations out there I guess. Realistically though, itā€™s probably completely unnecessary. Iā€™m pretty sure the Z-Wave network only changes when additional nodes are added. Maybe re-graphing after a network heal would be a good thing, but the whole every 5 minutes is overkill.

Agreed, thatā€™s pretty much where Iā€™ve landed on this. The graph is nice for occasional troubleshooting, and I can just kick it off manually should I feel compelled to do so. Thanks for all your work on this!

@luma You came up with the answer and didnā€™t realize it.

You need to use the output of which python3 when run from within your venv.

So the shell command would be;

shell_command:
  z_wave_graph: /srv/homeassistant/bin/python3 /home/homeassistant/.homeassistant/python_scripts/z_wave_graph.py

WORKS GREAT!!!

@luma If ā€œz_wave_graph.pyā€ resides in ā€œ/home/homeassistant/.homeassistant/bin/ā€ your Shell Command would be:

 shell_command:
  z_wave_graph: /srv/homeassistant/bin/python3 /home/homeassistant/.homeassistant/bin/z_wave_graph.py

Iā€™m not sure I understand. It looks like the 2nd example you posted lines up exactly with the current contents of my z-wave-graph.yaml:

(homeassistant) homeassistant@hass:~$ cat ~/.homeassistant/shell_commands/z-wave-graph.yaml
z_wave_graph: /srv/homeassistant/bin/python3 /home/homeassistant/.homeassistant/bin/z-wave-graph.py

Am I missing some detail?

Are you saying, this is not working for you?

Correct. It works when pasted on the command line while suā€™d as homeassistant and with the venv activated. It returns rc 1 when run from home assistant.

Thatā€™s weird, the missing piece for me was ā€œ/srv/homeassistant/bin/python3ā€

Did you create the ā€œbinā€ directory?
If so, you may need to check the permissions.

Did you make the script executable?
chmod 755 ~/bin/z-wave-graph.py

This post here covers what youā€™re asking and provides a bit of context.

administrator@hass:/home/homeassistant/.homeassistant$ sudo su -s /bin/bash homeassistant
homeassistant@hass:~/.homeassistant$ source /srv/homeassistant/bin/activate
(homeassistant) homeassistant@hass:~/.homeassistant$ ls -la /home/homeassistant/.homeassistant/ | grep bin
drwxrwxr-x  2 homeassistant homeassistant       4096 Feb 12 12:46 bin
(homeassistant) homeassistant@hass:~/.homeassistant$ ls -la /home/homeassistant/.homeassistant/bin
total 24
drwxrwxr-x  2 homeassistant homeassistant 4096 Feb 12 12:46 .
drwxr-xr-x 12 homeassistant homeassistant 4096 Feb 13 21:44 ..
-rwxrwxr-x  1 homeassistant homeassistant  543 Feb 13 09:13 bandwidth.php
-rwxrwxr-x  1 homeassistant homeassistant 9945 Feb 11 10:49 z-wave-graph.py
(homeassistant) homeassistant@hass:~/.homeassistant$

FYI: I was experiencing the same issue as you, until I added the python path.
ā€œreturn code: 1 NoneType: Noneā€

Hereā€™s a question - does the user account youā€™re using for homeassistant have a default shell assigned? Mine doesnā€™t as a security measure. I wonder if there are issues running shell commands as a user with no shell?

1 Like

Not sure, how would I check, Iā€™m not too savvy when it comes to shell and scripts.

The default shell for a user is stored in the /etc/passwd file (which doesnā€™t actually contain passwords and is world readable by default).

grep "homeassistant" /etc/passwd
homeassistant:x:999:999::/home/homeassistant:

The default shell is the last field, where fields are separated by :. In this case, the last field is empty, meaning this user has been explicitly denied a login shell. This is the general approach used when running applications under a service account to prevent people from logging in with that account.

Same for me.

homeassistant:x:1001:1001::/home/homeassistant:

Hi,

I have an error connecting to home-assistant url using the Docker image. I use SSL with a Letā€™s Encrypt certificate and receive the error:
SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

also using from the python interactive shell:
> import requests
> requests.get('https://MYURL:8123')

while doing requests.get('https://MYURL') works, obviously the webserver is different but the certificate is the same.

Itā€™s not a Z-Wave graph specific error but I hope someone can help me.

This does not seem to run when http component is placed inside of a package instead of inside the configuration.yamlā€¦ any advise?

Tested it worked if i put the http back in configuration.yaml but i would like to run http in a separate packageā€¦

Sorry, no ideas from me. I havenā€™t started exploring packages yet.

Is it possible to make an add-on for HASS.IO?
Would be very nice to have!

3 Likes

What do you mean by http component, the url?

Mine is setup in a package and functioning just fine?

Hi
Maybe a newbie questions. I am runing HA on docker and I have tried to install the z-wave graph according to your instructions. How ever I am getting an ā€œError running command: /usr/local/bin/python3 /config/bin/z-wave-graph.py, return code: 1ā€ and I do not know what is wrong.
Any ide where to look?