I want to have a counter how many times the door has been opened. Right now I have this:
sensor:
- platform: statistics
entity_id: binary_sensor.front_door
precision: 0
name: Door
sampling_size: 100
max_age:
hours: 24
but it creates a counter which accumulates all state changes - i.e. ON and OFF. This effectively doubles the number of door openings and makes it impossible to distinguish an opening from closing.
How can I make a counter that only counts the “open door” states?