In this tutorial video, I'll show you how to create a bar graph to track occupancy in a specific room or to monitor the daily usage of a device. In addition, I teach you how to make custom sensors yourself! Let me know in the comments what you think!
Just as a note, some installs will not run Studio Code Server. File Editor is a more basic add-on, but it will allow you to edit the YAML files as well and will show you basic YAML errors. To be honest, I rarely edit YAML these days, so I keep File Editor instread of Studio Code. This is a fantastic video for people who are not sure how to start with graphing and reporting. Home Assistant has so much data stored, sometimes it can be hard to know where to start to pull the correct data up. Thanks for showing us and making it look so easy :)
@@SmartHomeJunkie You are one of my favourite youtubers, because you explain the more useful stuff in ways that are so easy to understand and implement for people watching. I am a bit geeky so don't mind the complex stuff in somethings, but for my home automation I really just want that to work with minmal fuss, and your videos allow that
Well done, works perfectly. I would like to extend the usage of the graph to monitor the time my fridge is actually cooling, but the sensor which is available is a power sensor (non zero value = fridge on). What should I need to modify in the apex chart to get is working, as if it was an on/off state ?
I've been using Home Assistant since 2020, How am I just discovering you? So glad I'm subscribed now! I'm not great with code but your instructions made me feel like I was a pro.
I'm so grateful that you found my channel and subscribed! It means a lot to me. I'll continue to provide clear instructions to help you navigate Home Assistant without any coding stress.
Excelente Tutorial, funciona a la perfección. Para que no les pase lo que me paso a mi tienen que usar la entity creada en el historic stats y no la de equipo que quieren monitorear. Dure media hora rompiéndome la cabeza de que porque no me funcionaba.
Holy cow this is exactly what I was looking for! I've never messed with the coding side of HA before so I was nervous. You made it super easy and clear. Thanks so much! The only question I have is on your lines 18 & 19, what is tickAmount?
Oh and one more question! Is there a way to export this information, say weekly, to a document or device? I'm trying to help my wife keep track of her work hours without writing things down on post-its. lol
Great video Ed! I've been using something similar - how much time kids watch TV, how long the heating was on and for example how much solar panels were working in a day. It really is fun when you get those statistics. One thing I still haven't done is home many times somebody walked in kitchen :D
I have set this up to show daily energy usage by device. However the data is appearing cumulatively, rather than resetting at zero each day. Is that a problem with the sensor, or the style of apex graph? Is it also able to be set to show an hourly breakdown of a 24hr period?
Hi Ed, great tutorial again, thanks. Can I ask you a different question? Is it possible to make a dashboard on which only devices/entities can be seen when they are "on"? Love to hear about it.
Thanks for the love and appreciation for the tutorial! You rock! Now, about your question, there's a difference between history and long-term history. Long-term history is also saved, but it's in a different location and I'm not sure if the long-term history will be taken into account with this method. As of 2023.12, the long-term statistics are shown on the history graph, so maybe it will be visible with this method too. I didn't check this though.
@@SmartHomeJunkie OK, thank you, I will wait and see… 😀 I have one location sensor generated according to this video from you and 2 standard temperature sensors from Sonoff that I would like to have full history visibility. Reading articles on web, but still not clear where to put the codes I found 🤷🏻♂️
Only a question because i have a problem with the sensor.... the date is, for example 2.72h, anyway i should obtain 2h 43 min... why the sensor give me 2.72h? im using your code... can you help me?
I have a sonof powr3 device which is always on so cant use that for time tracking. Id like to track the time for when there is load over 1W for instance. How would i specify that as a state. I tried stat ">1" but doent work
super video. there is a way to show a custom stats? (show_states: true) becausem the time showme is "1h 0m 0s 410ms", and i want only hour and minute. tks
I was running into this same issue. I removed the as_duration: hour and I got "1.1h", which wasn't exactly what I wanted but it was better than seeing seconds and milliseconds.
Can you make a new video on presence sensor video so that based on my family member in the house the alaram system turns on and when all of the leave the house alarm sustem turn off. I know you have one old video on it. but it would be good to have new one based on all the updates home assitant had over the year before the video was done
The alarm system video that I created is already refreshed a couple of months ago and still valid. The menu of Home Assistant changed a bit (and will keep changing), but you should find a way around that. I have no plans for another update in the near future.
Hi Ed, I run HAOS on an Intel NUC 13 Pro Tall I7-1360P with 16GB RAM and an Samsung 870 EVO 1000GB 2.5" SATA-600. I've been told that this is plain stupid overpowered for my Home Assistant use case but with your great videos i might just become an hard core user in the future so i thought what the heck. I like the idea of limiting read/write and DB size by just including the intities you really want and have use for in charts and what not. My problem is that i don understand what every single entity does and if i will miss out on something by not including it. I think the "safest way" for me with my lack of HA skills is to just leave everything be. Just to give you an idea of just how low my use case are i have 19 Z-Wave products controlled by an Aeotec Z-Stick gen 7 USB-adapter, 8 Zigbee products controlled by an SONOFF Zigbee USB Dongle Plus, 4 Frigate cameras and i have 635,6 GiB free space on my HD and my MariaDB is 216,1 MB and most of that is recordings from my Dahua Technology WizSense 5MP IP67 Dome Cameras. Anyway, now to my question. Do you think i will run into problem with read/write issues on my Samsung 870 EVO 1000GB 2.5" SATA-600? Have a nice day
@@SmartHomeJunkie well that's true, sorry. Was thinking about energy measurement. Is it possible to use multiple entities in one sensor to get a total usage / amount? Let's say to count several lights (time being on) or energy plugs (power usage)?
created a history sensor and got the graph working but seeing weird values I think because the history sensor has not yet captured enough "history", waiting to see if it all works
Ed I downloaded the code but I get some error, please help? can not read a block mapping entry; a multiline key may not be an implicit key (15:8) 12 | name: Toilet verlichting Light 13 | entityid: light.lumi_lumi_light_aqcn ... 14 | state: "on" 15 | start: "{{ now().replace(hour=0).rep ... -------------^ 16 | end: "{{ now() }}"
@@SmartHomeJunkie i like the way you separate stuff in include files like sensors. Is it possible to include all mariaDB and all included entities in one "db" file or must the recorder stuff live in the config file? Sorry. This question should been in the 5 tip about taking load from DB by including only specific entities.
I found an automotive pressure sensor. I used an Aqara ZigBee magnetic sensor. I removed the reed switch and soldered the pressure sensor to it. I got that idea from Mark Watt Tech's 4 Simple Wireless Bed Sensors. It's working great. Now I want to set up an automation to remind me to get up and move when I've been sitting for an hour.
In this tutorial video, I'll show you how to create a bar graph to track occupancy in a specific room or to monitor the daily usage of a device. In addition, I teach you how to make custom sensors yourself! Let me know in the comments what you think!
Just as a note, some installs will not run Studio Code Server. File Editor is a more basic add-on, but it will allow you to edit the YAML files as well and will show you basic YAML errors. To be honest, I rarely edit YAML these days, so I keep File Editor instread of Studio Code.
This is a fantastic video for people who are not sure how to start with graphing and reporting. Home Assistant has so much data stored, sometimes it can be hard to know where to start to pull the correct data up. Thanks for showing us and making it look so easy :)
Thanks Brendan.
@@SmartHomeJunkie You are one of my favourite youtubers, because you explain the more useful stuff in ways that are so easy to understand and implement for people watching. I am a bit geeky so don't mind the complex stuff in somethings, but for my home automation I really just want that to work with minmal fuss, and your videos allow that
@@EsotericArctos Thank you Brendan
Well done, works perfectly. I would like to extend the usage of the graph to monitor the time my fridge is actually cooling, but the sensor which is available is a power sensor (non zero value = fridge on). What should I need to modify in the apex chart to get is working, as if it was an on/off state ?
You can create a template sensor that converts the state to on or off and use that 't template sensor in the graph.
I honestly thought I was already subscribed, but I am now.
Thank you! 🙏🏻🙏🏻🙏🏻
Dank je, mijn natuurkunde leraar zei altijd. "Meten is weten" 😊
Yup, de mijne ook!
I've been using Home Assistant since 2020, How am I just discovering you? So glad I'm subscribed now! I'm not great with code but your instructions made me feel like I was a pro.
I'm so grateful that you found my channel and subscribed! It means a lot to me. I'll continue to provide clear instructions to help you navigate Home Assistant without any coding stress.
I discovered HA in August last year. Share the sentiment!
@@MitchRSA That's great to hear. I'm glad my videos helped you!
Nice and clear explanation, thanks!
Thanks, usefull as always.
Thank you so much for your support 🙏🏻
Great video!
Do you know if it's possible to get a weekly, monthly or even yearly usage?
Interesting question! You can try to experiment with the duration within the graph. I didn't test it myself though.
Excelente Tutorial, funciona a la perfección. Para que no les pase lo que me paso a mi tienen que usar la entity creada en el historic stats y no la de equipo que quieren monitorear. Dure media hora rompiéndome la cabeza de que porque no me funcionaba.
Hmmm, that's new for me. 🤔
Holy cow this is exactly what I was looking for! I've never messed with the coding side of HA before so I was nervous. You made it super easy and clear. Thanks so much! The only question I have is on your lines 18 & 19, what is tickAmount?
Oh and one more question! Is there a way to export this information, say weekly, to a document or device? I'm trying to help my wife keep track of her work hours without writing things down on post-its. lol
You can write then to a Google sheet. See my Google sheet video for this.
@@SmartHomeJunkie I was working my way through that one now! Sorry I asked before I searched. lol
Awesome! I see a nice usecase for this to track the daily amount of hours I spent on my phone (using the home assistant companion app).
That's indeed a nice use case as well!
Hi Ed, this one is to keep in my library . Great tutorial!👍
Thank you
Great video Ed! I've been using something similar - how much time kids watch TV, how long the heating was on and for example how much solar panels were working in a day. It really is fun when you get those statistics. One thing I still haven't done is home many times somebody walked in kitchen :D
Yeah, it's great fun! I guess I will create many more of these in the next couple of weeks 😂
I have set this up to show daily energy usage by device. However the data is appearing cumulatively, rather than resetting at zero each day. Is that a problem with the sensor, or the style of apex graph?
Is it also able to be set to show an hourly breakdown of a 24hr period?
Great video thank you. How often does the custom sensor update? Can you define a custom refresh rate?
I believe it changes as soon as the value of the entities within the sensor change.
Great! Which presence sensor do you recommend for use with Home assistant?
The Aqara FP2 or the Everything Presence One.
Thank you very much for this video. Can this be used to track the maximum and minimum temperature?
I would create an automaton for that.
hey, how many time before sensor will be available (after reboot)?
Hi Ed, great tutorial again, thanks. Can I ask you a different question? Is it possible to make a dashboard on which only devices/entities can be seen when they are "on"? Love to hear about it.
Yep, try the auto-entities card from HACS.
Thank you for this tutorial, much appreciated.. One question, how much of history will be stored for a sensor? Is it unlimited?
Thanks for the love and appreciation for the tutorial! You rock! Now, about your question, there's a difference between history and long-term history. Long-term history is also saved, but it's in a different location and I'm not sure if the long-term history will be taken into account with this method. As of 2023.12, the long-term statistics are shown on the history graph, so maybe it will be visible with this method too. I didn't check this though.
@@SmartHomeJunkie OK, thank you, I will wait and see… 😀 I have one location sensor generated according to this video from you and 2 standard temperature sensors from Sonoff that I would like to have full history visibility. Reading articles on web, but still not clear where to put the codes I found 🤷🏻♂️
Only a question because i have a problem with the sensor.... the date is, for example 2.72h, anyway i should obtain 2h 43 min... why the sensor give me 2.72h? im using your code... can you help me?
I have the same question, how to display it has 2:43 (hh:mm) not 2.72, more readable
I have a sonof powr3 device which is always on so cant use that for time tracking. Id like to track the time for when there is load over 1W for instance. How would i specify that as a state. I tried stat ">1" but doent work
Nice video.
Why is the y-axis not linear (grid at 0, 2, 4, > 5
You can set it yourself in the apexchart card.
Thanks! that was very helpfull!
I'm glad it helped!
super video. there is a way to show a custom stats? (show_states: true) becausem the time showme is "1h 0m 0s 410ms", and i want only hour and minute. tks
I was running into this same issue. I removed the as_duration: hour and I got "1.1h", which wasn't exactly what I wanted but it was better than seeing seconds and milliseconds.
Can you make a new video on presence sensor video so that based on my family member in the house the alaram system turns on and when all of the leave the house alarm sustem turn off. I know you have one old video on it. but it would be good to have new one based on all the updates home assitant had over the year before the video was done
The alarm system video that I created is already refreshed a couple of months ago and still valid. The menu of Home Assistant changed a bit (and will keep changing), but you should find a way around that. I have no plans for another update in the near future.
Great video Ed, with your examples I will take a look how much time I spend behind the PC. I think it will be a boring graph. 😅
Hahaha!
Hi Ed,
I run HAOS on an Intel NUC 13 Pro Tall I7-1360P with 16GB RAM and an Samsung 870 EVO 1000GB 2.5" SATA-600.
I've been told that this is plain stupid overpowered for my Home Assistant use case but with your great videos i might just become an hard core user in the future so i thought what the heck.
I like the idea of limiting read/write and DB size by just including the intities you really want and have use for in charts and what not. My problem is that i don understand what every single entity does and if i will miss out on something by not including it.
I think the "safest way" for me with my lack of HA skills is to just leave everything be.
Just to give you an idea of just how low my use case are i have 19 Z-Wave products controlled by an Aeotec Z-Stick gen 7 USB-adapter, 8 Zigbee products controlled by an SONOFF
Zigbee USB Dongle Plus, 4 Frigate cameras and i have 635,6 GiB free space on my HD and my MariaDB is 216,1 MB and most of that is recordings from my Dahua Technology WizSense 5MP IP67 Dome Cameras.
Anyway, now to my question. Do you think i will run into problem with read/write issues on my Samsung 870 EVO 1000GB 2.5" SATA-600?
Have a nice day
That shouldn't be a problem.
Thanks Ed, Very nice Sensors 👌
Thanks Sevag!
@@SmartHomeJunkieWorks like a charm, is it possible to add unique_id to this sensor?
@@sevagjb I think you can yeah. Didn't try it.
@@SmartHomeJunkieI tried to add it but it didn't work I got an error in the config file, Thanks any way it is awesome SENSOR 💯
@@sevagjb Yeah. I think I will add more of them in my setup the next couple of weeks. So many ideas pop up in my head right now.
Hi,
isn't the sensor the same as the "utility meter" helper? What are the benefits using a extra yaml file instead of the helper?
It's not a utility, is it? Try to measure occupancy with the utility meter helper...
@@SmartHomeJunkie well that's true, sorry. Was thinking about energy measurement.
Is it possible to use multiple entities in one sensor to get a total usage / amount? Let's say to count several lights (time being on) or energy plugs (power usage)?
You can add those to a group and use the group in the sensor. That's what I did with the living room lights.
@@SmartHomeJunkie okay perfect, thanks. And if I do understand that code right, the sensor (counter) is getting reset every day at midnight / 12a.m.?
@@hammerlized That is correct!
Great Video again 👍👍👍
Thank you Manfred!
Hi! I try with input_text.washer_state and at status i put "washing" and dosen t work...
A good one for this would be how many times the fridge has been opened and the Time open
Great idea!
created a history sensor and got the graph working but seeing weird values I think because the history sensor has not yet captured enough "history", waiting to see if it all works
That's probably the reason yeah.
Ed I downloaded the code but I get some error, please help?
can not read a block mapping entry; a multiline key may not be an implicit key (15:8)
12 | name: Toilet verlichting Light
13 | entityid: light.lumi_lumi_light_aqcn ...
14 | state: "on"
15 | start: "{{ now().replace(hour=0).rep ...
-------------^
16 | end: "{{ now() }}"
No idea really. There must have gone something wrong when you copied and pasted the code.
Good Job 👍🏻
Thank you for your compliment. 🙏🏻
You sir, are awesome.
Thank you so much 🙏🏻🙏🏻🙏🏻
Love you videos, buying every code snippet :)
Oh! Thank you for your support Peter!
@@SmartHomeJunkie i like the way you separate stuff in include files like sensors. Is it possible to include all mariaDB and all included entities in one "db" file or must the recorder stuff live in the config file? Sorry. This question should been in the 5 tip about taking load from DB by including only specific entities.
@@PeterCarlsson-k7n I think it should be in the configuration.yaml.
Thanks!
You're welcome!
nice video! :D
Thank you!
help me sir
where to put sensor: !include sensors.yaml ? I got error duplicate key
tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor: !include sensors.yaml
sensor:
- platform: systemmonitor
resources:
- type: disk_use_percent
arg: /config
- type: disk_use
- type: disk_free
- type: memory_use
- type: memory_free
- type: swap_use_percent
- type: ipv4_address
arg: eth0
- type: processor_use
- type: processor_temperature
- type: last_boot
- platform: time_date
display_options:
- "time"
- "date"
- "date_time"
- "date_time_utc"
- "date_time_iso"
- "time_date"
- "time_utc"
- "beat"
you can have just ONE 'sensor:'
I'm looking into how to monitor how much time I sit in my computer chair every day
Mount a vibration sensor or pressure sensor to your chair.
I found an automotive pressure sensor. I used an Aqara ZigBee magnetic sensor. I removed the reed switch and soldered the pressure sensor to it. I got that idea from Mark Watt Tech's 4 Simple Wireless Bed Sensors. It's working great. Now I want to set up an automation to remind me to get up and move when I've been sitting for an hour.
Tell me how to display data in telegram? Thank you.