Home Assistant Sensor Data Logging With InfluxDB & Grafana | Home Automation Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in last week's video we learned how to use ESP home to create a node that can monitor temperature and humidity home assistant allows you to view the history of the node data but the functionality here is very limited if you want to be able to analyze sensor data over extended periods of time then you will have to use an add-on module one such module is Griffin by the end of this video you will learn how to visualize data by building something like this so let's dive in Groff Anna is a very popular tool that allows you to visualize your data in many different ways as can be seen in this demo clip it is mainly an analytics tool and it does not store data by itself in order to store data we would need to use a database platform and a very common one that works well with crow fauna is in flux TB in flux TV is a time-series database which means that it automatically adds a timestamp to the data that is stored this allows us to easily filter the data based on time as we will see later in the video here's what we will be doing we are going to start by creating a new node that will consist of a temperature sensor and an air quality sensor we will then set up in flux DB such that it will receive and store the sensor data finally we will set up graph honor to visualize this data this may sound complicated but doing this is extremely simple I will Krissy run through the process in this video and the description will contain links to written posts also please navigate to the channel playlist section where you will find all the related videos I'm going to start by creating a new node we have learned how to do this in last week's video so please have a look at that if you are not familiar with the step in simple terms we start by providing the basic node details then restarting ASP home and finally configuring the sensors that are attached to the node here's what the final configuration file looks like it consists of the Diaz 18 B 20 sensor the sgp 30 sensor as well as the i2c interface that we need for the sgp 30 all these lines have been obtained from the ESP home website for the individual components this address is unique to each temperature sensor and needs to be updated using an address allows you to add multiple temperature sensors on the same bus I'm using the one from the website example configuration for now and I will show you how to obtain the value for your sensor a little later once this is done you simply need to compile it and then flash it to the board using the ESP 32 flash tool here's the wiring diagram that I'm using and everything is pretty straightforward once the code has been uploaded we need to enable the node and then add the node to the dashboard check the logs and you will see that it has detected the temperature sensor so we simply need to copy the sensor ID and add that to our configuration upload this wirelessly using over-the-air updates once this is done you will be able to breathe the temperature data the SDP $0.30 I can take up to 12 hours to calibrate itself so these values will be low for a while you can view this in the logs once we obtain the baseline value we would need to add it to the sensor configuration also sensor and recommends recalibrating the sensor every seven days as it has an internal drift I will not be doing this as I'm not too concerned about the actual value as long as I can obtain a trend and monitor it I repeated this process and I've added a second node as seen here these are what the nodes look like in real life I need to redo the room sensor node as the sensors are too close to the ESP module but the nods were next to each other when this was being recorded but the room sensor values are unusually high and I think it is due to their proximity to the ESP module now that the nodes are in place we need to store the values in a database head over to the add-on store search for influx DB and install it insulation will take a few minutes depending on your internet connection so I will fast forward this bit then scroll down disable SSL by typing in the word false as seen here don't forget to hit the Save button scroll back to the top to enable the show in sidebar option and start the add-on I've disabled SSL as home assistant is running on a local network this means that we are protected from the external world and not using SSL will simplify the setup for us you can then scroll down on the refresher logs to check the status again it will take a minute or two to start so give it some time in the refresher logs to wait for it to start in Jenks which is the web server being used once you see this message you can scroll back to the top and open the web UI to view something like this now we get to the admin tab and start by creating a new database with the name home assistant we also need to create a user account and I'm going to use home assistant as the username and password once that is done we need to give this user all permissions like so now that the database is set up we need to link it to home assistant so that the data from home assistant is automatically stored in influx DB for this we need to update the configuration of the ml file for adding some lines to it and these can be obtained by navigating to the influx TV add-on and then clicking this link if you scroll down a bit you will obtain the lines that we need to add to the configuration file so I'm just going to copy them for now the easiest way to update the configuration that Yama file is by installing the configurator add-on so use the add-ons to search for configurator and install it then enable the show in sidebar option and started we can then navigate to it and use the folder icon to open the configuration that Yama file finally we can paste the lines here and update the database username and password to suit our configuration all that's left to do is restart home assistant and give it a couple of minutes to reboot once it has rebooted we can open up in flux DB now we get to the explore tab and verify that it is receiving data from home assistant as you can see we can view the different sensors which indicates that in flux TB is communicating with home assistant all that's left to do now is install graph fauna so search for it in the add-on store and install it again this step will take a few minutes so give it a bit of time roll onto disable SSL like before unable the show in sidebar option and start the add-on you can refresh the logs to view the status and wait for it to start the engine server which may take a couple of minutes once it has started we can open the web UI to get something like this Gravano needs access to the data from in flux TB so it is a good idea to create a new user for it open up in flux DB and create a new user with the name and password as griffons again we need to give it permissions once done simply copy this part of the URL as we will need it in a minute we can then open up Griffin ah at a data source and select influx dB paste the URL that we copied and updated as shown here don't forget to replace the underscore with a hyphen and at the port number eight zero eight six to the end you can then add the database name which is home assistant and then the username and password which is Griffin on both cases once that is done we simply need to save and test it and as you can see the communication is working as it should that's on the setup that we need to do in order to visualize the data we simply need to create a new dashboard and I'm gonna start with the query option be sure to select influx DB as the data source and we can then start selecting the variables that we are interested in I'm going to start with the room temperature for this query and I'm going to give it an Elias called room you can add multiple queries to a single panel so I will add the workspace temperature and give it a suitable Elias we can then move on to the visualization tab and adjust the time frame to the last five minutes so that we can see the most recent data the data will be shown as points and we can change this to lines by telling Ravana to ignore the null values and connect the readings you can also turn off the fill appearance but I like it so I will enable it as you can see there is a lot of flexibility when it comes to configuring things there we've only scratched the surface of things we can then move to the general tab to give this panel a name and finally we can save the dashboard by giving it a name this to add the other sensor readings as shown here you can even rearrange the panels to suit your requirements this is what the dashboard looks like after a couple of hours Griffin has a lot of options and features for you to use and we look at some of them in future videos please do consider subscribing and activating notifications if you haven't already thank you for watching and I will see you in the next one
Info
Channel: bitsNblobs Electronics
Views: 16,609
Rating: 4.931973 out of 5
Keywords: grafana tutorial for beginners, grafana influxdb tutorial, introduction to grafana, introduction to influxdb, installing grafana with influxdb in home assistant, sensor logging home assistant, hassio, grafana hassio, influxdb hassio, wemos d1 node, esp8266 home assistant, esphome home assistant, getting started with home assistant
Id: VkBEU3DmtjY
Channel Id: undefined
Length: 9min 15sec (555 seconds)
Published: Wed Feb 05 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.