Display how long a switch has been turned on

I’m looking for a way to display how long a switch has been in the “on” position in the last 24 hours, can it be done?

Have you looked at this:

1 Like

Thank you, that’s exactly what I want.