Hi i want to check if a entity has as been ‘on’ at least 1x (no matter how long) in the last 24 hours. And if yes do nothing and if no start a action.
So something like:
if:
- condition: state
entity_id: binary_sensor.pump
state: "on"
within:
hours: 24
then:
- service:
..........
else:
- service:
............
is this posible with automations? can not find it.
Thanks!
You could set up a history stats sensor to count the number of times the device turned on in the last 24 hours. Then check if it’s more than zero.
Thanks for thinking with me.
i now have:
- platform: history_stats
name: Check ON status pump
entity_id: binary_sensor.pump
state: "on"
type: count
start: "{{ now().replace(hour=0, minute=0, second=0, microsecond=0) }}"
duration:
hours: 24
What i want is that hassio counts the ‘on’ per day, each day.
Am i correct that with above code, hassio starts counting on 00:00 for 24 hours en then resets the count to back 0?
Or am i missing something for that?