INSANE STATISTICS In Home Assistant With Grafana! - TUTORIAL

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi so you use home assistant and you also want to see the statistics in home assistant in a really nice way then you should use havana if you don't know how hafana works i will tell you in this video how it works so watch this [Music] you can see the statistics of home assistant in a really simple way through the history but that's quite simple there is an add-on for home assistant that makes it much more nice and that is called hafana and i'm going to show you how havana works in this video so let's dive into it what you currently see on the screen is my own grafana environment but we're going to set it up in another environment so i can take you there step by step so let's go to the other environment and the first thing that we have to set up is influx db for that we go to the supervisor and then we go to the add-on store and then we search for influx db there it is and i'm going to install in flexdb by clicking on install this might take a while so influx db is installed and now we're going to start influx db let's start it first and this might take a while and you can see the progress of the starting of influx db in the log so if we go to log and we refresh and you see things happening here so we refresh every now and then until it is started so i'll come back if it's started so while it's starting up i'm already going to do one thing i'm going to info and i'm going to say show in sidebar so that my influx db link is visible in my menu here let's check the log again okay let's click on influx db on the left side it might be that i get an error yes i get an error bad gateway and that means that it's not yet started so let's just patiently wait until it will be available so go back to supervisor influx db log hold on i'm going to start in nginx any moment now so let's try again yes there it is it is starting get a black screen in the beginning just be a little bit more patient really depends on how fast your system is so this is my staging environment so that's not that fast but this is influx db so now there are a couple of steps that i have to take i have um to create a database and user now in influx db so that's what i am going to do and that's for that i have to go to the influx db admin and i'm going to create a database here and i'm going to get the database the name home assistant i'm making this really simple you can make it give it a name any name you want but i'll make it really simple so that's the database base so we have a database here now which is called home assistant and now i have to create a user that can access the database so clicking create user let's call the user home assistant and well i'll give it to password home assistant too and then i'm going to save it and i'm giving the permission all so now i have user home assistant with password home assistant with permissions all and if i let's see if i now go to explore i see i have a home assistant autogen database but there's nothing in it yet i don't see anything here so the next step that we have to do is that we have to connect the influx db database that we just created to home assistant so that home assistant can feed that database with the data from home assistance so how do you do that for that you have to go to your configuration.yaml and if you don't know how to do that watch the summershare video to see how you can connect to the configuration.yaml file and if you did that then you can go to your explorer and in the explorer on your server on your home assistant server you will find the configuration.java file so when you are in the configuration.yaml i have to add some code to connect influxdb to home assistant and this is the code you have to add here so it is called influx db and the host name is this it's always the same you can find the code in the description below it's on my github page and as you can see i refer to the database username and password that i entered in influx db before so this is what you have to enter and then you save the configuration.yaml and then you go back to home assistant and then you go to configuration server controls check configuration see if your changes in your configuration.jumbo are valid and if so click restart and now we wait so home assistant has restarted so let's see what we will see in influx db now so if you click that it will start up then we go to explore and as you see now i have 12 domains and 42 entities so if i click on this i see all the domains that i have in my home assistant and i see all the entities for instance i see the entity of the living room temperature so if i click here on living room and i say here current temperature then you see that there is one little dot here which shows that the current temperature is around 20 degrees because of the fact that i just installed it these graphics are very limited because it has just been recording the graphics so i don't see much yet but this means that there's already something going on and within influx db you can also create various graphs if you go to visualization then you can choose all kinds of graphs that you want to uh to show but for now it's really simple and i will show you at the end of the video how it looks like when you have a database that has been filled for the last 30 days so now we have influx db running and with influx db you already can create great graphics but with graphana you can even create better graphics so now we are going to install graphana for that we go to the supervisor again we go to the add-on store and then we're going to search for funner and we're going to install rafana and now we wait so havana is installed and now i'm going to start havana let's look in the log here it is starting okay i guess it is started let's go to info and click show in sidebar so that we see it on the left side in a menu and then i'm clicking on grafana here so currently garfana won't show you anything because it's not yet connected to the influx db database because it retrieves its data from the influx db database so we're going to add a data source so let's see that's here in configuration data sources we're going to add a data source and we're going to add an influx db data source so i'm going to select this one then i will give it a name let's say home assistant and i'm going to say this is influx ql and then the url that you have to type in here is http slash e 0 d 7 e 9 5 4 6 so this is the address of your influx db server 0954 yes that's correct access is server and for the rest i'm going to leave this the same and now we have to say the database of the influx db which is home assistant the user that we created in influx db was also with the name home assistant and the date the password that i gave it was also home assistant and then i'm going to say save and test and if everything is correct then it will say the data source is working that's really cool because that means that now we have a connection between hafana and influx db so if i go to the dashboards of havana i don't see anything here yet but i'm going to create a new dashboard so let's say plus create dashboard and the dashboard basically consists of different panels with graphics or statistics in it so i'm going to add a new panel here and um this might seem a bit difficult but it's not that really difficult you you really have to play with it but let's say i'm going to create a formula that shows the temperature in my living room so i'm selecting a measurement here i'm going to say state where and then my entity id is the entity id of home assistant so the value will be living room and then i'm going to say what do you want to show here so it's the field value and i can say for instance in this my current temperature and then i can say i want the mean current temperature over time but i can also oh sorry i can also select for distinct and this shows sort of the same thing now here um this is really limited now because as i said before the recording of the data is just has just started so you won't see much but in a minute i will go to my live environment and then you will see much more it's just to show you a bit how this works so here are visualizations so i can say what kind of graph do i want to show here do i want to see your graph or do i want to see a step so it shows now it's 21 degrees or gauche or bargoj but i'm going to say graph and then i can also say i want to see where i want to see bars instead of lines well there's a lot of things that i can do here but it's better it if i show you in my live environment the only thing that you need to know now is that you have graffana installed and it is working and now i'm going to show you how you can create your own dashboards here so for that we go to my live environment of havana and let's start with the first dashboard here that is weather today so this is one of my dashboards that i i created what you can see here is a bar meter that shows what the outside pressure is at the moment the current outside temperature the maximum temperature that we had today and also the trend bar meter is it going down or is it going up um and here for instance is a graph about how much rain fell let me create a dashboard from scratch so that might give an idea on how that works so i'm going to plus create dashboard add new panel and we're going to say select measurement well let's make it state in this case where the entity id is living room and i want to show the current temperature and i want to show distinct and here's my graph of the current temperature i can change the panel title so i'm going to say living room temperature and what i can do is i can make it bars i can remove the lines but i think lines is better to use i can also change the color so i can say let's make it yellow and so this is one simple thing so let's apply this so now i created one [Music] panel on my dashboard let's create another panel next to that so let's well maybe save the dashboard new dashboard is let's call it tutorial save so we're going to add another panel add panel add new panel and let's say that i want to know how much rain fell so let's say select measurement millimeters where entity id is and then it's saying rain last hour uh let's keep this to mean let's make it parse now don't make it mean i'll make it distinct then my bars are more nice range should be blue so now you see the amount of rain that fell in the last couple of hours so let's up give the name rain apply so now i have my uh my second panel and so this way you can create more and more panels save the dashboard so you can create more and more panels and i'm going to show you some example panels now [Music] let's say see let's go to i got this week so this is for instance this weather this week so i can see per day how much rain fell i can see the mean humidity i can see my barometer and all all kinds of stuff i can also see for instance how the corona is doing so this is let's say not for the last seven days but for the last 30 days if you want to know how to do this there is an integration in home assistant which is called corona so if you go to configuration integrations there is the corona virus integration so add that and then you can add that data to grafana go back to nirvana so that's the corona one and i also measured the power in my house because i have a smart meter so i can see the power of today so power consumption the energy consumption total the production of my solar panels and the power production uh i can see what my solar panels did today what the power consumption was today how many how much power i used in my studio today and also some specific devices that i use power and i can also see that for the whole week but basically i can change that here because i have lost seven days here but i can also say well maybe i want to see it for the last 30 days so i can see it for the whole month so you have so much flexibility here and there's another dashboard for instance system where i can see my light sensor in the living room how that performs uh the temperature in my bathroom how that went today the pressure in in my bathroom the humidity in my bathroom the processor usage of my raspberry pi disk use memory usage of my raspberry pi and the cpu temperature so there's really a lot that you can do in in grafana so many possibilities i cannot explain all of them you really have to play with it to see how everything works create your own dashboards and get really insights on on how your house is performing i hope this video helped if you liked it give it a thumbs up subscribe to my channel click the little bell and i'll see you next time bye bye you
Info
Channel: Smart Home Junkie
Views: 66,103
Rating: undefined out of 5
Keywords: Home Assistant, smarthome, smart home, how to, tutorial, homeassistant, install, add ons, add-ons, addon, hassio, hass.io, home automation, internet of things, raspberry pi, smart home automation, smart home tech, home assistant setup, grafana, statistics, bar graph, line graph, stats, how to install grafana, history graph
Id: rXF-LycbjoA
Channel Id: undefined
Length: 20min 15sec (1215 seconds)
Published: Thu Feb 04 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.