Is your config published somewhere? I can try to fix the problem then.
Hi Happy Leaves,
I forgot to thank you for your great work.
The panel shows up in in Home Assistant and so does the graph, it is just the zooming that does not work.
I copied the svg-pan-zoom.min.js file straight from GitHub and created the HTML file with your example using Notepad++. I have run chmod 777 on all the files just to make sure it is not a permission issue.
Do you think it could have something to do with NGINX?
Make sure that HTML file is correct. The error you pasted makes me think there’s a problem there, since it is a syntax error.
So I am assuming that I need to setup nginx to be able to access it remotely? I dont have that set up and I am getting localhost refused connection errors.
If so does anyone have an nginx for dummies link? It seems to be way over my head
Think I copied the wrong content for svg-pan-zoom.min and after correcting it Chrome kept it in its cache even after me clearing it, not sure but it is working now! I also upgraded to 0.39.2 but I doubt that has any influence/
Thank you so much!
NGINX is not required, you can expose Home Assistant directly onto the internet if you want.
I am running NGINX on Ubuntu but it should be the same on the Pi. The first time I did set it up was with this guide: www.htpcguides.com/secure-nginx-reverse-proxy-with-lets-encrypt-on-ubuntu-16-04-lts/
However have a look at this guide:
You do not need NGINX. The file is served via Home Assistant.
I guess I might need some help then. I created the www directory and added the files and added the following to my panels_iframe.yaml
graph: title: "Graph" icon: mdi:vector-polyline url: "http://localhost:8123/local/graph.html"
I tried changing localhost to 127.0.0.1 and had the same result which is a greyed out ipanel that says “localhost refused to connect.”
The chrome console shows:
Uncaught (in promise) DOMException: Only secure origins are allowed Failed to load resource: net::ERR_CONNECTION_REFUSED http://localhost:8123/local/graph.html
However, I tried in Firefox and have the same issue.
Are you running chrome/Firefox on the local machine? You are now linking to local host which only works if on the local machine. It might be better to replace local host by the IP address of your homeassistant server.
I’m receiving this error:
Traceback (most recent call last):
File “/usr/lib/python3.4/runpy.py”, line 170, in _run_module_as_main
File “/usr/lib/python3.4/runpy.py”, line 85, in _run_code
File “/srv/hass/hass_venv/lib/python3.4/site-packages/hagraph/main.py”, line 30, in
File “/srv/hass/hass_venv/lib/python3.4/site-packages/hagraph/main.py”, line 25, in main
graph = make_graph(conf)
File “/srv/hass/hass_venv/lib/python3.4/site-packages/hagraph/init.py”, line 242, in make_graph
File “/srv/hass/hass_venv/lib/python3.4/site-packages/hagraph/init.py”, line 209, in add_core_edges
File “/srv/hass/hass_venv/lib/python3.4/site-packages/hagraph/init.py”, line 147, in add_scene
for entity, data in data[const.CONF_ENTITIES].items():
Can you share your scene? It’ll be one that doesn’t have
entities in it.
Well, your question made me find it right away I have a bad habit of typing “entites” instead of “entities”…
This looks awesome nice work.
I am trying to set it up for myself. I am running Hassbian.
graphviz graphviz-dev installed successfully but when i try
pip install hagraph i get the following
[email protected]:~ $ pip install hagraph Downloading/unpacking hagraph Downloading hagraph-1.0.2.tar.gz Running setup.py (path:/tmp/pip-build-AQ5CSC/hagraph/setup.py) egg_info for package hagraph Downloading/unpacking networkx==1.11 (from hagraph) Downloading networkx-1.11-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded Downloading/unpacking homeassistant>=0.37 (from hagraph) Downloading homeassistant-0.40.1-py2.py3-none-any.whl (6.8MB): 6.8MB downloaded Downloading/unpacking pygraphviz>=1.4rc1 (from hagraph) Downloading pygraphviz-1.4rc1.tar.gz (105kB): 105kB downloaded Running setup.py (path:/tmp/pip-build-AQ5CSC/pygraphviz/setup.py) egg_info for package pygraphviz warning: no previously-included files matching '*~' found anywhere in distribution warning: no previously-included files matching '*.pyc' found anywhere in distribution warning: no previously-included files matching '.svn' found anywhere in distribution no previously-included directories found matching 'doc/build' Downloading/unpacking decorator>=3.4.0 (from networkx==1.11->hagraph) Downloading decorator-4.0.11-py2.py3-none-any.whl Downloading/unpacking aiohttp==1.3.3 (from homeassistant>=0.37->hagraph) Downloading aiohttp-1.3.3.tar.gz (526kB): 526kB downloaded Running setup.py (path:/tmp/pip-build-AQ5CSC/aiohttp/setup.py) egg_info for package aiohttp Traceback (most recent call last): File "<string>", line 17, in <module> File "/tmp/pip-build-AQ5CSC/aiohttp/setup.py", line 61, in <module> raise RuntimeError("aiohttp requires Python 3.4.2+") RuntimeError: aiohttp requires Python 3.4.2+ Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 17, in <module> File "/tmp/pip-build-AQ5CSC/aiohttp/setup.py", line 61, in <module> raise RuntimeError("aiohttp requires Python 3.4.2+") RuntimeError: aiohttp requires Python 3.4.2+ ---------------------------------------- Cleaning up... Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-AQ5CSC/aiohttp Storing debug log for failure in /home/pi/.pip/pip.log
then trying to run:
python3 -m hagraph -i /home/homeassistant/.homeassistant/configuration.yaml -o /home/homeassistant/.homeassistant/111.png
[email protected]:~ $ python3 -m hagraph -i /home/homeassistant/.homeassistant/configuration.yaml -o /home/homeassistant/.homeassistant/111.png /usr/bin/python3: No module named hagraph
not really sure how to sort this out. apologies for the long post i wasn’t sure what needed to provide.
pip3 install hagraph, or make sure you’re in a python3 virtual environment before using
With this command:
[email protected]:~ $ python3 -m hagraph -i /home/homeassistant/.homeassistant/configuration.yaml -o /homepi/graph.png
I get the following error:
Traceback (most recent call last): File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.4/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.4/dist-packages/hagraph/__main__.py", line 30, in <module> main() File "/usr/local/lib/python3.4/dist-packages/hagraph/__main__.py", line 26, in main to_agraph(graph).draw(args.get('output_file'), prog=args.get('prog')) File "/usr/local/lib/python3.4/dist-packages/pygraphviz/agraph.py", line 1469, in draw data = self._run_prog(prog, args) File "/usr/local/lib/python3.4/dist-packages/pygraphviz/agraph.py", line 1331, in _run_prog raise IOError(b"".join(errors).decode(self.encoding))
Any idea what’s wrong?
First, i should say thanks for the hint of using the virtual environment to install
hagraph it worked. I had to open the shell as
homeassistant user to get permission to install it, though.
(homeassistant) [email protected]:/home/pi $ python3 -m hagraph -i /home/homeassistant/.homeassistant/configuration.yaml -o /home/homeassistant/.homeassistant/www/graph.svg
THIS IS AWESOME…
The panel is displaying correctly however the shell command doesn’t produce
graph.svg when it is called. i deleted the image manually then tried firing the command from within HA but no luck it only works when i login as
homeassistant user with a virtual env over ssh
Thanks i just got errors when i attempted to install hagraph but with pip3 worked. Thanks for posting it.
Thanks for sharing this i can see my graph now. Let’s see if i can make it zoom in.
Sorry for a beginner’s question how do i add the zoom?
Assuming you got the graph working I take it that you used the HTML from Happy Leave`s Github? In that case download the svg-pan-zoom.min.js from here https://github.com/ariutta/svg-pan-zoom/tree/master/dist and put it in the WWW folder. Clear the cache in Chrome or whatever browser you are using and you should be good to go.
That deed the trick, now all works fine.