Server side
Here I will try to roughtly explain the server side of the story. This is not a complete guide in setting up Home Assistant, Mosquitto and Grafana. That is way to extensive to cover here. But there is a lot of good guides out there.
Homie
The first time you start up the ESP it will work as an access point. From a mobile device you need to connect to it and configure the following:
- SSID and password of the AP it should connect to
- Hostname/IP and port of the MQTT server (in my case mosquitto)
- A base topic (in my case “homies/”)
After all this information has been provided it will write the configuration to the Eeprom and it will reboot. In the future it will automatically reconnect at power up.
Home Assistant
For home assistant to listen to the MQTT messages it needs to be configured. A minimum configuration that needs to be added is found in Github here.
Basically there is a mapping from each MQTT topic into an actual sensor in Home Assistant. All those sensors are grouped together for a nice view like this:
Another part of the configuration is connecting it to Influxdb. If this connection is made then all changes to sensor state will automatically be logged to the database. This is excactly what we want.
Grafana
For making those nice graphs you need to install Grafana and setup a datasource that points to the influxdb.
Then you create a dashboard and add each sensor. Here is an example of the setup of the sound sensor (Here I do some moving averaging of the data, because they are quite noisy):
An exported json file of my setup can be found here.
What now?
I hope this has inspired you to build you own data aquisition system. Comments are welcome 🙂
Did you use a PC or a RaspberryPI/like board for server?
I have an Intel NUC running vmware ESXi 6.5… It can handle a whole bunch of virtual servers 🙂 I just set up a virtual server for my home automation.
I found this (in italian)
Influxdb, Grafana, Docker su raspberry
http://www.mauroalfieri.it/elettronica/influxdb-grafana-docker-raspberry.html
Thanks for sharing on Arduino forum!
Thanks – Good luck with installing it on your pi. It should be quite easy… But Italian is not my best 😉