Hello! For a few days now I try to get the right duration a switch is currently on today. I tried the following:
sensor:
- platform: history_stats
name: Dauer_Poolpumpe_Ein
entity_id: switch.shelly_1
state: "on"
type: time
start: "{{ now().replace(hour=0, minute=0, second=0) }}"
end: "{{ now() }}"
The problem, it gives me somehow totally wrong values. It doesnt reset to zero at 00:00, it floats around 11 hours even if it was not even on or just 2-3 hours, am I understanding here somethin wrong?
For more context: I want to get the switch running at the evening atleast one hour a day if other automations have not switched it on during the day, therefore I need the hours it was already on today. Thanks for your help.