Using Template as a Stopwatch for entity "ON" runtime?

Hello geniuses!! :slight_smile:

I can’t really find a way of adding a stop-watch so that when an entity has been turned on, I can see how long it has been in that state and have it displayed “live” in a Mushroom card Secondary information area. For example:


Is there a way to perhaps use a template and the last changed status?
Or history_stats?

For example, I can get the time of last_changed. could this be used “somehow” and subtracted from current time which in theory would show “time running”?

{% set time=(as_timestamp(states.input_boolean.backyard_garden_sprinkler_tap.last_changed) | timestamp_custom('%I:%M')) %}

Scratching my head…