(Solved for now) Automation to turn on the lights when people are at home and lux is very low

 alias: Schakeling - Verlichting aan bij duister
 description: ''
 trigger:
   - platform: numeric_state
     entity_id: sensor.schuurtje_weerstation_bh1750_illuminance
     below: '250'
     for: '00:05:00'
 condition:
   - condition: time
     after: '9:00'
     before: '19:00'
   - condition: or
     conditions:
       - condition: state
         entity_id: person.x
         state: home
       - condition: state
         entity_id: person.y
         state: home
 action:
   - service: notify.telegram
     data:
       message: Schakeling - Verlichting aan bij duister
   - type: turn_on
     device_id: xxx
     entity_id: switch.woonkamer_voorraam_links
     domain: switch
   - type: turn_on
     device_id: xxx
     entity_id: switch.woonkamer_voorraam_rechts
     domain: switch
   - type: turn_on
     device_id: xxx
     entity_id: switch.woonkamer_dressoir_links
     domain: switch
   - type: turn_on
     device_id: xxx
     entity_id: switch.woonkamer_dressoir_rechts
     domain: switch
 mode: single

The general idea is that when the sensor reports less than 250 lux between 9:00 and 19:00 and person.x or person.y is at home it will turn on the light.

alias: Schakeling - Verlichting aan bij duister
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.schuurtje_weerstation_bh1750_illuminance
    below: '250'
    for: '00:05:00'
condition:
  - condition: and
    conditions:
      - condition: or
        conditions:
          - condition: state
            entity_id: person.x
            state: home
          - condition: state
            entity_id: person.y
            state: home
      - condition: or
        conditions:
          - condition: time
            after: '9:00'
          - condition: sun
            before: sunset
            before_offset: '-0:15'
action:
  - service: notify.telegram
    data:
      message: Schakeling - Verlichting aan bij duister
  - type: turn_on
    device_id: xxx
    entity_id: switch.woonkamer_voorraam_links
    domain: switch
  - type: turn_on
    device_id: xxx
    entity_id: switch.woonkamer_voorraam_rechts
    domain: switch
  - type: turn_on
    device_id: xxx
    entity_id: switch.woonkamer_dressoir_links
    domain: switch
  - type: turn_on
    device_id: xxx
    entity_id: switch.woonkamer_dressoir_rechts
    domain: switch
mode: single

I think I’ve got it. I’ve hopefully also added a extra feature so it’ll run between 9:00 and 15 minutes before sundown.

It’s not working as planned, any ideas?

This is my automation at the moment, seems to work for now.
Somehow I have to use the /5 minute trigger, because triggering it at lux doesn’t work (good).

alias: Verlichting - Verlichting automatisch aan/uit
description: ''
trigger:
  - platform: time_pattern
    minutes: /5
condition: []
action:
  - choose:
      - conditions:
          - condition: or
            conditions:
              - condition: numeric_state
                entity_id:
                  - sensor.lichtsensor_oost_illuminance_lux
                  - sensor.lichtsensor_zuid_illuminance_lux
                  - sensor.lichtsensor_west_illuminance_lux
                attribute: illuminance_lux
                below: '1500'
              - condition: numeric_state
                entity_id: sensor.lichtsensor_woonkamer_illuminance_lux
                attribute: illuminance_lux
                below: '13'
          - condition: or
            conditions:
              - condition: time
                before: '08:14:00'
                after: '07:00:00'
                weekday:
                  - mon
                  - tue
                  - wed
                  - thu
                  - fri
              - condition: time
                before: '21:00:00'
                after: '08:30:00'
                weekday:
                  - mon
                  - tue
                  - wed
                  - thu
                  - fri
              - condition: time
                before: '21:00:00'
                after: '08:00:00'
                weekday:
                  - sat
                  - sun
          - condition: state
            entity_id: group.alle_gezinsleden
            state: home
        sequence:
          - service: light.turn_on
            data: {}
            target:
              entity_id:
                - light.woonkamer_voorraam_links
                - light.woonkamer_voorraam_rechts
                - light.woonkamer_dressoir_links
                - light.woonkamer_dressoir_rechts
                - light.eetkamer_eetkamertafel
      - conditions:
          - condition: numeric_state
            entity_id:
              - sensor.lichtsensor_oost_illuminance_lux
              - sensor.lichtsensor_zuid_illuminance_lux
              - sensor.lichtsensor_west_illuminance_lux
            attribute: illuminance_lux
            above: '1500'
        sequence:
          - service: light.turn_off
            entity_id: all
    default: []
mode: single