Automation except between certain time

I’m trying to see if there is a ‘not’ in the conditions - I cannot see it but I may just have missed it.

Basically I want an automation to take an action except between certain a certain time in the day so not during that period of time (and specific days).

I’m sure it is obvious but I can’t see how to do it or find a relevant example.

All I can think is to do an or for firing the action between 00:00 to 12:00 OR 14:00 to 23:59. Is that the best solution?

You want a condition like this

  condition:
  - condition: time
    after: '22:30:00'
    before: '05:00:00'

This is not a NOT.

The example above will only run the automation between 10:30pm and 5am.

I’m sure you can adjust as needed.

Are the times listed above what you’re looking for if so

  condition:
  - condition: time
    before: '12:00:00'
    after: '14:00:00'

Should work? At least I assume it would

1 Like

Ok great, thanks. I have ended up with this as it was not the same every day :frowning_face:

It is getting your head around the fact the trigger does the action except between the before & after times.

- condition: or
  conditions:
    - condition: time
      after: '16:00:00'
      before: '14:30:00'
      weekday:
        - mon
        - tue
        - wed
        - thu
    - condition: time
      after: '16:00:00'
      before: '12:30:00'
      weekday:
        - fri
    - condition: time
      weekday:
        - sat
        - sun

Cheers.

That depends on how you have the times set up.

the before and after is in relation to midnight (00:00:00).

So “before: 14:30:00” means from midnght to 14:30:00. “after: 16:00:00” means after 16:00:00 but before midnight. so the way you have it it will only fire from midnight to 14:30 or 16:00 till midnight.

If you had the before and after reversed it it would run from 14:30 to 16:00 since the “before: 16:00” is limited by the “after: 14:30” and the “after: 14:30” is limited on the other end by the “before: 16:00”.

Hopefully I didn’t confuse it any more…:crazy_face:

No that is fine and exactly what I want. Ididn’t want it to fire between 14:30 to 16:00.