Automation won't fire - need help

So I thought a simple automation with time pattern trigger during set time condition but I can’t get it to work. Ran it manually and also tried once last night changing to 2 minutes and it appeared to try and run outside time condition and recognized it didn’t meet criteria. Here’s the code:

alias: Vegetable fan every 2 hours
description: ""
trigger:
  - platform: time_pattern
    hours: "2"
condition:
  - condition: time
    after: "06:00:00"
    before: "20:00:00"
action:
  - type: turn_on
    device_id: a171498f371b3745d52ec188525f2666
    entity_id: switch.backyard_plug
    domain: switch
mode: single


I assume you want it to execute every 2 hours (between 6:00 and 20:00)?

Change this:

    hours: "2"

to this:

    hours: "/2"

Reference: Time Pattern Trigger

1 Like

Thanks Taras that fixed it. Wonder why the UI doesn’t code it properly.

1 Like