The total counter should keep counting and never reset.
But yes, Historical stats helper could work. I’m trying to test it by setting startdate to today and duration 7D.
The thing is that a counter can be increment and decremented. I don’t want just the number of state changes, but the sum of the time window. So the sum should ideally be sum of increments minus sum of decrements within the time window…
(I know that there could be other ways to solving this, for example such as maintaining a separate counter that represents. sum of 7 days coupled with long-running automations that span or wait 7 days to trigger, that will then remove the number they represent, but seems like a slightly over-engineered path and I’m currently more interested in solving it with the tools already present in HA).