Automation - Turn Heater On Every 2 Hours

add this condition for even:

- condition: template
  value_template: "{{ now().hour % 2 == 0 }}"

add this condition for odd:

- condition: template
  value_template: "{{ now().hour % 2 == 1 }}"

thanks Petro.
I’ve done exactly so as “workaround”, I just thought there is more clever solution.
anyway - thanks for quick response.

regards,
Valdas

It’s not a work around, it’s the current way unfortunately. Maybe in the future they will add a attribute to trigger that filters even and odd. I doubt it’s even on the dev’s radar. Might want to add a feature request.

Condition would be best way to do the odd hour thing. I don’t think any automation system, commercial or DIY, are granular enough on the triggers to split odd/even hours like that without using a condition.

so, anyone knows when the automation will run for first time?? at 23.00.00 or 01.00.00 ???

‘after’ means 01:00:00

Neither

See the time pattern trigger docs:

You can prefix the value with a / to match whenever the value is divisible by that number

Yours will first run at midnight.

1 Like

thank you! It runs exactly every 2 hours and the first run is at midnight!

thanks