Statistics in Home Assistant with InfluxDB and Grafana

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to our next video in this video we will take you through setting up influx db in order to store statistical data from home assistant along with grafana which lets you create dashboards to display this data it can be used to give an overview of the state of your house and can show changes over time first we will set up influxed db as you can probably guess from the name this is a database engine that is installed in addition to your home assistant database in order to keep your home assistant database lean and therefore responsive there is a limit on the history kept by home assistant the default is 10 days it is not recommended to keep older data in your main home assistant database therefore we use a separate database engine to keep this data and we can set our own retention period without affecting the performance of homer system you can install influx db as an add-on in home assistant or you can use a separate database server for simplicity we will use the add-on to install go to settings add-ons and click the add-ons store scroll down the list and click on influx db click on install [Music] when it is installed enable the watchdog and show in sidebar click start it can take a few moments to start up the database engine go to the log and check for the word capacitor in large ascii art refresh if you don't yet see this when it's running click on influx db this will bring you to the influx db dashboard the icons on the left of the screen are the main menu we are looking for the influx db admin option click it we need to set up a database click the create database button when prompted name the database and click the green tick the retention policy is set by default to infinity this will log data without deletion if you wish to set a limit click on autogen and modify it click on the users tab click create user enter a username and a password click the green tech we now need to set up permissions of this user move the mouse to none and click the drop down select all then click apply we now need to tell home assistant to record data to this new database click file editor or your editor of choice open configuration.yaml add the following lines to the file these are also in the description below change the ip address under host [Music] and the database name and credentials save the file [Music] we need to reboot home assistant click on developer tools click on check configuration to ensure everything is okay if you get an error check the configuration.yaml if all is well click on restart upon reboot click on influx db [Music] click the explore icon second from the top you should see an entry homeassistant.autogen or similar click on this if you can see expandable entries under measurements and tags then influx db is now storing data you can explore data here to confirm if all is well we can now install grafana to do this click settings add-ons and add-on store scroll down and click on grafana click install enable the watchdog and show inside bar click start check the log to make sure grafana has started if all is well click grafana you'll be presented with the welcome to grafana dashboard click on the cog icon and select data sources click add data source from the list select influx db in the http section enter the url to access your influx db instance this will be http colon backslash backslash followed by your ip then colon 8086 don't use localhost or the loopback address if it's hosted on your home assistant server scroll down to the influxdb details section and enter the database name and credentials [Music] [Music] for http method select get [Music] finally click save and test go back to gravana by clicking the icon at the top you are now back at the welcome to grafana dashboard this provides links to information to help you use gravana including help articles to remove these click on the panel title drop down and click remove click remove again do this for each panel until you have a blank dashboard at the top right click the add panel button click add a new panel this brings you to a query builder in the from section click select measurement we're using a temperature sensor as a demonstration so we'll select greasy click the plus after where to select the device select entity id click select tag value then select the temperature sensor the graph above will refresh with the data for this sensor in the select section click the plus button select last so we'll always have the last value of the sensor we now need to format the chart and we'll use a section on the right to do this first we want to change the panel title to something meaningful so we know what the panel represents the description is optional the change is updated immediately for this chart we want the dots to always be connected to make it clearer we can change the interpolation a curve looks more natural for this type of data we can also modify the legend we'll add the last recorded value click save to save the dashboard give it a name home already exists so we'll name this home dashboard we're now back to the dashboard view of the newly created panel this can be resized and moved the chart data adapts accordingly we'll add another panel click on add a new panel we'll add humidity click select measurement and select percentage the chart will display everything with a percent value click the plus after where and select entity id click select tag value we want the humidity value the chart shows the data points as before [Music] set a panel title we'll select the same options as before curved interpolation always connect values and the last value in legend click save [Music] it'll ask if you want to describe your changes click save click apply to go back to the dashboard you now have two panels and can move them change size and set them side by side we'll now add a different chart type i have a power monitoring start plug let's record the voltage in select measurement select viva voltage it will display plotted values as before click the plus after where select entity id and select a smart plug we'll title the panel smart plug voltage we can set chart options but instead we'll change the chart type at the top click on time series this will show the different chart types available click gauge it'll initially show in red as we've got a threshold set the default is 80. either remove it or set it to an appropriate warning value in the standard options section we can choose the unit scroll down to energy and select vault click save then to go back to the dashboard click apply move the panels as appropriate but always remember to click the save icon this is a basic overview of setting up a grafana dashboard it is a very powerful charting add-on and can create very complex dashboards beyond the scope of this introduction another video is planned for the near future to cover more grafana dashboards please comment if you'd like us to cover more topics like this or have ideas for future videos thank you for watching if you like this video please click on the like button please subscribe to see our other smart home and home assistant videos you
Info
Channel: Smart Home Addict
Views: 44,609
Rating: undefined out of 5
Keywords: home assistant, home automation, grafana influxdb tutorial, installing grafana with influxdb in home assistant, influxdb grafana, sensor logging home assistant, influxdb tutorial for beginners, influxdb tutorial, grafana with influxdb tutorial, home assistant influxdb tutorial, influxdb grafana docker, grafana, influxdb, influxdb grafana setup, influxdb tutorial docker, grafana influxdb dashboard tutorial, influxdb grafana home assistant, grafana influxdb query tutorial
Id: KM6UC4tMVYo
Channel Id: undefined
Length: 16min 10sec (970 seconds)
Published: Tue Jun 07 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.