I would like to provide the family with daily/weekly/monthly reports on all kind of topics like:
how much time the tv was on
time spent in the shower
energy usage
time in bed
distance traveled by car
etc. etc.
(I know I will not make myself popular )
I guess Iām not the first wanting to do this. What is the best way to approach this? Are there any (custom) components that can help or do I really need to go down the road of all kind of input helpers and automations to calculate and reset measures?
I see similarities with the utility_meter component which has cycles and source sensors, but it doesnāt track time or other units.
3.- Customize the utility so that you can benefit from the long-term statistics
homeassistant:
[...]
customize:
# Add an entry for each entity that you want to overwrite.
sensor.boiler_daily_usage:
state_class: measurement
In this way, although my recorder saves the data for two days, you will have the mean, max and min values in the long-term statistics database.
I build this up one week ago and it is working nicely so far:
Thanks a lot Tim! Creative and close to what I had in mind! @tom_l : I realize this is actually what you meant as well. I confused the history_status integration with the āhistoryā one.
One drawback I see is that it will be hard to measure based on multiple conditions? E.g. how long did the tumble dryer run during electricity peak tariff.
@timseebeck thanks for the information. I set this up like you documented, but I can get the graph to work like you are showing. It looks like your āmeanā amounts are somehow fluctuating, where as my āmeanā hours seems to the the actual mean hours for the life of the data. Are you using a āstatistical graph cardā in your screen shot above? if so do you mind sharing a screenshot of the configuration of that graph? I must be doing something.
For my scenario I am tracking how long I am watching tv, so I really just want to see hrs tracked/tv on per day, it seems like for your screenshot that you have basically accomplished that with the logic you provided.
Hi Richard, sorry for the long silence. I donāt use that setup anymore (lots of things change in HA in one year). But let me explain what I use now.
This is a plot showing the number of hours per day my boiler is on:
What we need
A binary sensor that registers the state, in my case: binary_sensor.boiler_light
A history stats sensor sensor.tiempo_caldera_on (sorry, spanish) that registers the time the previous sensor is āonā:
sensor:
- platform: history_stats
name: Tiempo Caldera On
entity_id: binary_sensor.boiler_light
state: 'on'
type: time
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
end: '{{ now() }}'
A custom card called history-explorer-card, which is amazing, with this configuration:
type: custom:history-explorer-card
cardName: historycard-75569561
tooltip:
showLabel: false
statistics:
enabled: true
mode: mean
defaultTimeRange: 3w
header: Time boiler ON
uiLayout:
toolbar: top
selector: hide
graphs:
- type: bar
title: ' '
options:
interval: daily
entities:
- entity: sensor.tiempo_caldera_on
name: ''
color: rgba(255,0,0,1)
fill: rgba(255,0,0,0.15)
Almost 2 years after I created this topicā¦ I wrote a custom integration that Iām really excited about. It easily measures all examples I mentioned in the topic start and much more!
I will create a new topic about this integration but before that I hope to find some interested beta testers in this topic.
Check it out: MeasureIt and let me know your thoughts!
To be installed via HACS, not yet in the standard HACS repo, so to be added as a custom repository in HACS.
After that go to Settings ā Devices & Services ā + Add integration
Search for MeasureIt and follow the config flow.
Yes thought the sameā¦ Code sounds good when checked, but Iām always afraid about stuff w/o even simple documentation and some print screen for example of usage.