events, shell commands and TTS: my HA talks a lot
Hello,
Looks really cool!
I got it sort of working… I need to manually run the command to generate the graph. And I have to do that from within my venv. (I have set up hass with the AiO installer, which installs hass in a venv).
When I try to run the command to generate the graphic from normal cmd, it tells me the module is not installed.
When I run it from within venv, all is good.
I think I need to change my shell_command, but I don’t know how…
Also, the graph I create manually contains some items, but as I see it, it indeed only graphs automations? E.g, I also have an mqtt to use as devicetracker, which I use to calculate time to work, but it’s just a sensor and as thus does not show up in the graph? Is that correct?
Thanks for this cool project!
Yes. The only items that show up are those involved in scripts, automations, and scenes.
OK, that’s fine and as I thought. Expanding every day.
But do you know why the graph is not created automatically when hass is running in a virtualenv, like explained here : https://home-assistant.io/getting-started/installation-raspberry-pi-all-in-one/ ?
Probably using the wrong python. From your venv, do which python
.
Then in the shell_command
, replace python3
with that output.
You rock.
Works like a charm.
generate_graph: "/srv/hass/hass_venv/bin/python -m hagraph -i /home/hass/.homeassistant/configuration.yaml -o /home/hass/.homeassistant/www/graph.svg"
For those using the AiO installer.
Brilliant, thank you!!!
Oh, mine looks so simple compared to the other graphs.
I’ll have to branch out
I cant seem to get Graph your configuration up and runing.
Everything went fine until I ran the line,
python3 -m hagraph -i “/home/hass/.homeassistant/configuration.yaml” -o “/home/hass/.homeassistant/www/graph.svg”
and got result #1 below.
I then inserted into hagraph’s init.py after line 169,
if const.ATTR_SERVICE not in step and ‘service_template’ not in step:
continue
and got result #2
I am running Homeassistant on a spare laptop that I have and it has Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-62-generic x86_64)
I am mostly Z Wave based at this time and plan to build up modules based on the ESP8266 boards.
I have around 60 of them with OLED display’s I also have several raspberry pi2 boards along with several flavors of Arduino boards to also be added at a later time.
I’m more of a hardware guy and am stumble learning software.
I would love some guidance with this Graph your configuration setup.
Thanks!
Result #1
hass@Pavilion-dv6500:~$ python3 -m hagraph -i “/home/hass/.homeassistant/configuration.yaml” -o “/home/hass/.homeassistant/www/graph.svg”
Traceback (most recent call last):
File “/usr/lib/python3.5/runpy.py”, line 184, in _run_module_as_main
“main”, mod_spec)
File “/usr/lib/python3.5/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/usr/local/lib/python3.5/dist-packages/hagraph/main.py”, line 30, in
main()
File “/usr/local/lib/python3.5/dist-packages/hagraph/main.py”, line 25, in main
graph = make_graph(conf)
File “/usr/local/lib/python3.5/dist-packages/hagraph/init.py”, line 237, in make_graph
add_core_edges(conf, graph)
File “/usr/local/lib/python3.5/dist-packages/hagraph/init.py”, line 200, in add_core_edges
for name, data in conf[key].items():
AttributeError: ‘NodeListClass’ object has no attribute ‘items’
hass@Pavilion-dv6500:~$
Result #2
hass@Pavilion-dv6500:~$ python3 -m hagraph -i “/home/hass/.homeassistant/configuration.yaml” -o “/home/hass/.homeassistant/www/graph.svg”
Traceback (most recent call last):
File “/usr/lib/python3.5/runpy.py”, line 174, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File “/usr/lib/python3.5/runpy.py”, line 133, in _get_module_details
return _get_module_details(pkg_main_name, error)
File “/usr/lib/python3.5/runpy.py”, line 109, in _get_module_details
import(pkg_name)
File “/usr/local/lib/python3.5/dist-packages/hagraph/init.py”, line 170
if const.ATTR_SERVICE not in step and ‘service_template’ not in step:
^
TabError: inconsistent use of tabs and spaces in indentation
hass@Pavilion-dv6500:~$
The second error is related to indentation, check what indentation is used in the other rows, and apply the same (some editors auto insert tab when enter is pressed, even though the rest of the file uses spaces)
I removed the tabs and put in spaces and I now get the following, very similar to the original errors.
hass@Pavilion-dv6500:~$ python3 -m hagraph -i “/home/n4hbm/.homeassistant/configuration.yaml” -o “/home/n4hbm/.homeassistant/www/graph.svg”
Traceback (most recent call last):
File “/usr/lib/python3.5/runpy.py”, line 184, in _run_module_as_main
“main”, mod_spec)
File “/usr/lib/python3.5/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/usr/local/lib/python3.5/dist-packages/hagraph/main.py”, line 30, in
main()
File “/usr/local/lib/python3.5/dist-packages/hagraph/main.py”, line 25, in main
graph = make_graph(conf)
File “/usr/local/lib/python3.5/dist-packages/hagraph/init.py”, line 239, in make_graph
add_core_edges(conf, graph)
File “/usr/local/lib/python3.5/dist-packages/hagraph/init.py”, line 202, in add_core_edges
for name, data in conf[key].items():
AttributeError: ‘NodeListClass’ object has no attribute ‘items’
hass@Pavilion-dv6500:~$
I am having problems with installing hagraph
pi@raspberrypi:~ $ sudo pip install hagraph
Collecting hagraph
Using cached hagraph-1.0.1.tar.gz
Collecting networkx==1.11 (from hagraph)
Using cached networkx-1.11-py2.py3-none-any.whl
Collecting homeassistant>=0.37 (from hagraph)
Using cached homeassistant-0.38.4-py2.py3-none-any.whl
Requirement already satisfied: pygraphviz>=1.4rc1 in /usr/local/lib/python2.7/dist-packages (from hagraph)
Collecting decorator>=3.4.0 (from networkx==1.11->hagraph)
Using cached decorator-4.0.11-py2.py3-none-any.whl
Collecting jinja2>=2.8 (from homeassistant>=0.37->hagraph)
Using cached Jinja2-2.9.5-py2.py3-none-any.whl
Collecting typing<4,>=3 (from homeassistant>=0.37->hagraph)
Using cached typing-3.5.3.0.tar.gz
Collecting async-timeout==1.1.0 (from homeassistant>=0.37->hagraph)
Using cached async-timeout-1.1.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-yiRiWW/async-timeout/setup.py", line 1, in <module>
import pathlib
ImportError: No module named pathlib
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-yiRiWW/async-timeout/
Not really sure where to go from here, any help in the right direction would be amazing
Make sure you’re installing with Python 3. That looks like Python 2.
Thanks for this great plugin @happyleaves! It made me remember that although I have now around 35 sensors I do too less with automation. Time to do some automation scripting
That worked. Please excuse my noobness
Traceback (most recent call last):
File "/usr/lib64/python3.5/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib64/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.5/site-packages/hagraph/__main__.py", line 30, in <module>
main()
File "/usr/lib/python3.5/site-packages/hagraph/__main__.py", line 25, in main
graph = make_graph(conf)
File "/usr/lib/python3.5/site-packages/hagraph/__init__.py", line 236, in make_graph
add_core_edges(conf, graph)
File "/usr/lib/python3.5/site-packages/hagraph/__init__.py", line 206, in add_core_edges
add_alexa(intent, data, graph)
File "/usr/lib/python3.5/site-packages/hagraph/__init__.py", line 161, in add_alexa
target = entities_or_service(data['action'])[0]
IndexError: list index out of range
I created the iFrame and it is showing up in Home Assistant but I am unable to zoom.
In the www folder I got the following:
graph.html, with the content as shown on https://github.com/happyleavesaoc/home-assistant-graph
graph.svg, created using “sudo python3 -m hagraph -i /home/homeassistant/.homeassistant/configuration.yaml -o /home/homeassistant/.homeassistant/www/graph.svg”
svg-pan-zoom.min.js, copied from https://github.com/ariutta/svg-pan-zoom/tree/master/dist
Am I missing something?
Open up your browser’s console and see if you have any errors.
Thanks HappyLeaves,
I found got the following:
Uncaught SyntaxError: Unexpected token <
Uncaught ReferenceError: svgPanZoom is not defined
at window.onload (graph.html:18)
I will have a look into this but not sure if my skills will be sufficient
Maybe a bad copy-paste?