Run an automation every 2 hours with time_pattern

Hello,

I’m trying to run an automation every two hours and I’m not 100% sure how time_pattern platform works.

Would work?

  trigger:
    - platform: time_pattern
      hours: /2
      minutes: 0
2 Likes

Yep :+1: :+1:

Just need quotes around the /2

@petro Can this be achieved through the GUI too? As in “every 2 hours” and not “when the clock says 2”?

1 Like

Yep, just /2

2 Likes

Lovely, tested and it works perfectly! Solves my pet peeve of having to do “59” on the seconds field for every minute…

If you wanted the automation to run every 10 minutes would you put /10 in the minutes box in gui and leave hours and seconds empty?

Correct. Works perfectly.

2 Likes

The automations editor removes the Quotes, every time I place them…???
So it is not possible to get a recuring every hour for me.

You have to edit that in yaml mode.