Hi,
My goal is to measure the amount of time - per day - that the PS5 is running. I will determine if it is running when a power meter the PS5 is attached to exceeds 60W of draw.
Ultimately, I want to measure all the time spent in front of a screen (i.e. PS5 + Switch + TVs) within today, and then trigger something (a notification and/or even cutting the power to the PS5 entirely for the remainder of the day). But let’s just focus on getting the timer up and running for one device, namely the PS5.
I have googled this already, assuming people would have already done something similar.
The main one I was using as my template is this thread Count "on"-time of a binary-sensor - #4 by petro, but also Record TV ON hours and display as barchartH .
My understanding is that I should be able to do this with History Stats. But the sensor I created is not counting anything and just staying at 0.
This is where I am so far:
- platform: history_stats
name: "PS5 ON today"
entity_id: sensor.power_monitoring_plug_0x00123456789_power
state: "{{ states('sensor.power_monitoring_plug_0x00123456789_power') | float > 60 }}"
type: time
start: "{{ now().replace(hour=0, minute=0, second=0) }}"
end: "{{ now() }}"
Does that only work for binary sensors? Am I not allowed to only measure the power draw above 60 here?
How would I get this sensor (timer) to measure what I want it to measure?
TIA!