Daily sensor ON time?

Hello,

I have a chromecast device that i guess can be considered a binary sensor as it is ON only when the TV is on.
I’d like to measure how much the TV is ON per day via this data point.
I’m new to HA but I guess i need to define a template sensor, but i am not sure what formula i would be using to calculate daily uptime for the given sensor.

Does anyone know how tongo about this?
Thanks

No not a template sensor. Use this:

Awesome! Thanks!