Satistics sensor - how to reset?

I use some simple door and window sensors that do not measure battery.

I am using statistics sensors to count the number of times a sensor is activated so that eventually(!) I will know roughly how many activations are needed before the battery dies. Obviously it won’t be an exact science but will hopefully give me the ability to use an automation to warn of possible impending battery death.

Does anyone know how to reset the counter to zero?

my config

  - platform: statistics
    name: Front Door activation
    entity_id: binary_sensor.front_door
    sampling_size: 5000

Delete your home-assistant_v2.db and restart (you will lose all your history). Or rename the sensor and restart. Neither is ideal.

Understatement of the day!!! :slight_smile:

Thanks but I will have to think again.
I don’t plan to use either of those solutions!
I seem to remember reading about a counter custom component somewhere…

@klogg: Have you found a solution?

I’m afraid not.

I changed to using counters and then have an automation which increments them every time the sensor changes.

Not perfect but works ok.