Here’s an example with a timer which only runs when needed. It looks perhaps a little complicated because it has some virtual devices (Device Capabilities). I prefer those over having physical devices for easy maintenance.
I mainly work with zones for the same reason.
Hope this helps.

