WTH more statistics

I’d really love to see more in-depth statistics.

For example, it would be incredibly helpful to know the average time a device spends in a particular state, and how much that time typically varies.

For instance, if I knew that “70% of the time, this light is on for about 45 minutes, and 95% of the time it’s on for less than 2 hours,” I could confidently set an automation to turn it off after 2 hours, if it’s still on.

Also, it would be cool if I could trigger automations based on significant deviations from these typical usage patterns. Like trigger an automation if a device remains in a certain state for a period that’s significantly longer than usual, something like 7 standard deviations from the average. Particularly I’m thinking about my clothes washer which got stuck spinning clothes for hours, when it normally spins for just a few minutes at a time.

But it could also be useful for those lights that are super tough to automate. And you could just send yourself a notification that the garage lights have been on for longer than you normally do, ( like 4 standard deviations)

It would also be nice to see that average be a configurable rolling average. So things like clothes drying can fluctuate naturally with the seasons without triggering the notifications.

You can measure this now using:

And

The biggest issue with statistics generated by home assistant (and not the integrations linked above) is that the statistics information is only available for charting. There is no way to use it in automations. There is a WTH open for this.