Acumulating time

Hello,

I was searching hours but did not found the right. But I’m sure there is an easy solutiion.

Which WIDGET can I use to simply accumulate time when a specific sensor sends a signal.
The widget should start when the signal is high and stop when the signal is low. The widget should be
able to set a time triggert. When the accumulated time reaches the pre set time the widget shoult trigger something else. (In specific a system shall not run longer than 2 hours a day but the time just counts if the system is definitly ON. When the time is reached the power should be switched off by a connected relay)

Thanks for your help finding something.

Regards,
Thomas

You can easily do it by code

There isn’t a widget with this functionality.
You can do it in your sketch, or maybe look at Automations.

Pete.