9

I'm using Home Assistant for my home automation, it has some basic graphing capabilities but only for the last 24 hours. I'd like to create graphs both with fine granularity and over long periods of time.

I have a home office in the basement, where I smoke cigars. I have a large extraction fan with a pretty serious airflow that pulls the smoke out and keeps the room in negative pressure so the smoke and fumes doesn't reach any other parts of the house.

I am interested in seeing how the different fan speeds affects the temperature in other rooms in the basement, and how it again is affected by the outside temperature so e.g. summer vs winter.

For this I need to plot various temperature and other sensor data over long periods of time, and I need to be able to see how the different sensor readings correlate (or not).

What are some good graphing tools that are easy to interface with home automation and IoT sensors or the Home Assistant?

2
  • 2
    Related: iot.stackexchange.com/questions/168/…
    – Helmar
    Sep 7, 2017 at 18:53
  • 3
    I wonder if it might be better to reframe this question as asking for solutions to your specific problem rather than just looking for 'good tools'—these are often considered a little broad, but focusing on a specific use-case helps to give more specific answers.
    – Aurora0001
    Sep 7, 2017 at 19:23

2 Answers 2

9

InfluxDB in Domoticz

This is a database provided with the Domoticz installation on Raspberry Pi. It allows to use data with time series.

Domoticz uses this to modelize sensors' data

enter image description here

1
8

For Home Assistant specifically, you can connect to the SQLite database and use your own graphing software (or a script) to generate custom graphs. The Home Assistant blog demonstrates the use of Python with matplotlib to do this:

# Adapted from the linked code from Home Assistant.
import sqlite3
from matplotlib import dates
import matplotlib.pyplot as plt

import homeassistant.util.dt as dt

ENTITY_ID = 'entity id here'
START_DATE = 'date here'
END_DATE = 'date here'

values = []
timestamps = []

conn = sqlite3.connect('/home/ha/.homeassistant/home-assistant_v2.db')
data = conn.execute("SELECT state, last_changed FROM states WHERE entity_id = {} AND last_changed BETWEEN {} AND {}".format(ENTITY_ID, START_DATE, END_DATE))

for x in data:
    timestamps.append(dates.date2num(dt.parse_datetime(x[1])))
    values.append(float(x[0]))

plt.plot_date(x=timestamps, y=values, fmt="r-")
plt.ylabel('Value')
plt.xlabel('Time line')

plt.savefig('sensor.png')

The database schema is available here. What we are interested in is state objects; you should know the entity_id of the device you're interested in.

If you're familiar with Python, adapting that should be relatively easy, and you could even add a GUI or nicer command-line interface. Any language that can query the SQLite database will work fine, though.

Alternatively, you might consider exporting to CSV and using a spreadsheet program—no doubt this will be more challenging to automate, but may be more user-friendly if you're not a programmer.

1
  • 1
    I am familiar with Python :) Thanks for the suggestion, I didn't think to look in the Home assistant database. Sep 8, 2017 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.