The problem is that I am running in a virtual environment. I realize that now. I made some adjustments but didnât get far enough. My knowledge about python and the virtual environments are a bit too low.
I updated the python scriptâs first line to point to where I actually have python. I also updated the ~/config/ to point to ~/.homeassistant/ instead.
After that I ran it. No graphviz. Of course, itâs not in my virtualenv. Did a âpip install graphvizâ, not sure that is enough. I ended up with:
(homeassistant) homeassistant@ha-01:~/bin$ python z-wave-graph.py
Error fetching states
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/requests/utils.py", line 868, in check_header_validity
if not pat.match(value):
TypeError: expected string or bytes-like object
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/remote.py", line 203, in get_states
URL_API_STATES)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/remote.py", line 88, in __call__
url, params=data, timeout=timeout, headers=self._headers)
File "/srv/homeassistant/lib/python3.5/site-packages/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/srv/homeassistant/lib/python3.5/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/srv/homeassistant/lib/python3.5/site-packages/requests/sessions.py", line 494, in request
prep = self.prepare_request(req)
File "/srv/homeassistant/lib/python3.5/site-packages/requests/sessions.py", line 437, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/srv/homeassistant/lib/python3.5/site-packages/requests/models.py", line 306, in prepare
self.prepare_headers(headers)
File "/srv/homeassistant/lib/python3.5/site-packages/requests/models.py", line 440, in prepare_headers
check_header_validity(header)
File "/srv/homeassistant/lib/python3.5/site-packages/requests/utils.py", line 872, in check_header_validity
"bytes, not %s" % (name, value, type(value)))
requests.exceptions.InvalidHeader: Value for header {X-HA-access: 2431} must be of type str or bytes, not <class 'int'>
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/graphviz/backend.py", line 124, in render
subprocess.check_call(args, startupinfo=STARTUPINFO, stderr=stderr)
File "/usr/lib/python3.5/subprocess.py", line 266, in check_call
retcode = call(*popenargs, **kwargs)
File "/usr/lib/python3.5/subprocess.py", line 247, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib/python3.5/subprocess.py", line 676, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1282, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'neato'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "z-wave-graph.py", line 128, in <module>
zwave.render()
File "z-wave-graph.py", line 109, in render
self.dot.render(filename=self.filename, directory=self.directory)
File "/srv/homeassistant/lib/python3.5/site-packages/graphviz/files.py", line 176, in render
rendered = backend.render(self._engine, self._format, filepath)
File "/srv/homeassistant/lib/python3.5/site-packages/graphviz/backend.py", line 127, in render
raise ExecutableNotFound(args)
graphviz.backend.ExecutableNotFound: failed to execute ['neato', '-Tsvg', '-O', '/home/homeassistant/.homeassistant/www/z-wave-graph'], make sure the Graphviz executables are on your systems' PATH
Itâs not a big deal for me, I can wait a few weeks until someone else figures out what to do.
Anyway, I am the one who wrote one of the scripts you refer to. And my hope really was that someone would take the idea and make a more proper integration of it. I considered my own a proof of concept. The other project you linked I had missed. So I am grateful for your implementation, even more so the day I manage to run it.