Automation with several triggers/conditions

Greetings,

Recently I’ve been in battle with my automations. There’s one automation that tries to turn OFF all my lamps (group.allanatt) every hour after midnight if my bedlight (switch.undersangenlampa) is turned OFF

  - alias: VardagTurnOFF
    trigger:
      - platform: time
        at: '00:00:00'
      - platform: time
        at: '01:00:00'
      - platform: time
        at: '02:00:00'
      - platform: time
        at: '03:00:00'
      - platform: time
        at: '04:00:00'
      - platform: time
        at: '05:00:00'
    condition:
      - condition: time
        weekday:
          - mon
          - tue
          - wed
          - thu
          - fri
          - sat
          - sun
      - condition: state
        entity_id: switch.undersangenlampa
        state: 'off'
    action:
      service: homeassistant.turn_off
      entity_id: group.allanatt  

I dont understand why it doesn’t work. It doesn’t give me any errors when I check config

EDIT: The weekday condition is important as I want to develop this further to have different times for different days, but I want this one to work first

Kind regards,

What’s not working about it?

Actually I think I solved it, will check tonight, my rassbian time was set 2 hours behind, that’s probably why I didn’t see it happening

I am looking at this.

Couldn’t you use a trigger like:

trigger: 
  - platform: time
    hours: '/1'
    minutes: 0

That would trigger the automation to check every hour on the hour.

Then in your condition set:

condition:
  condition: time.
  after: '00:00:00'
  before: '05:00:00'

Add your other conditions in as needed.

If you want different times for different days, I’d likely do them as separate automations.

Use a similar thing, but just have the different conditions in the different automations. Either that or have the automation call a script with some templating.

The after and before time may need tweaking for your situation, but it should work.

Ignore the . after time. I am not sure whether it is just my end, but I can’t seem to get rid of it…