Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/happyleavesaoc/home-assistant-graph


https://github.com/happyleavesaoc/home-assistant-graph

graphviz home-assistant home-assistant-config

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

# home-assistant-graph [![PyPI version](https://badge.fury.io/py/hagraph.svg)](https://badge.fury.io/py/hagraph)

![Graph](graph-example.png)

## Demo

https://happyleavesaoc.github.io/hagraph.html

## Install

Install `graphviz`:
```
yum install graphviz graphviz-devel # RHEL/CentOS
apt-get install graphviz graphviz-dev # Ubuntu/Rasbian
```

Install `hagraph`:
`pip install hagraph`

Errors about `pygraphviz`? Try:

`pip install git+https://github.com/pygraphviz/pygraphviz.git --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib/graphviz/"`

## Run

`python3 -m hagraph -i -o `

## Suggested Integration

### Home Assistant Configuration

```yaml
panel_iframe:
graph:
title: Graph
icon: mdi:vector-polyline
url: "https://your.hass/local/graph.html"

shell_command:
generate_graph: "python3 -m hagraph -i -o graph.svg"

automation:
- alias: Generate graph
trigger:
platform: event
event_type: homeassistant_start
action:
- service: shell_command.generate_graph
```

### graph.html

In your `/www`:
```html







body { margin: 0; padding: 0; }


window.onload = function() {
svgPanZoom('#graph', {
controlIconsEnabled: false,
zoomScaleSensitivity: 0.7,
minZoom: 1
});
};

```

Be sure to get [svg-pan-zoom.min.js](https://github.com/ariutta/svg-pan-zoom) as well.