Time since last state change?

If you’re using the websocket version each entity will have a property timeSinceChangedMs. Which is the time in milliseconds since the state last changed.