WTH doesn't HA natively tell me how long a sensor has been turned on?

I have a sensor that is turned on or off as part of my goodnight/good morning automation. WTH does HA not natively and easily tell me how long I have been sleeping, and what my average sleep time is? I know I can set up things to tell me, but the code is a bit daunting. :slight_smile:

Seems like HA stores all the data, why can’t it natively give me statistics?

(In all seriousness, I do love HA, and this is a small WTH)

There is History Stats integration for that but I agree that would be much better to keep this information with every sensor. In UI it is visible how long has been from last update but would be nice if this is usable everywhere.

For instance I’d like to set up notification if some sensor doesn’t update any more witch is quite complicated to do now and needs additional sensor for that.

1 Like

My use case is tracking how long I slept last night (assuming that when I turn off the lights is when sleep starts), and to know what my average is. But I can see this being valuable with any entity type, not just a boolean on/off.

Similar to my request to show elapsed time of a state. It came about for exactly the same reason you stated. I can track how long my kid was in bed, but I’ve had to use grafana to get stats on that. Would be nice to see it in HA, even if it was just for the length of time an item was in a state.

1 Like