Binary sensor: Graph times "ON" per hour

I have a binary sensor that turns on and off based on external events at random times and for random durations.

What I want to do is to create a graph that tells me how many times per hour it turns ON - and then graph this metric (times on per hour) for a long duration, e.g. for 1 week.

E.g. I want to be able to see if the sensor on average turns on about 5 times per hour or less - or are there any extreme situations where it turned on 20 times per hour?

Any thoughts on how to achieve this?

History Stats sensor

1 Like

Cool! This will be great for setting up a Bayesian sensor!