Turn on activation based on lux between certain hours

Hi all,

I am new to Home Assistant and this forum.

I am trying to create an automation that does the following:

When the illuminance (lux) of a sensor is below 20 lux for 2 minutes
and the time is between 16 and 22 hour
2 scenes are started

The automation is only working when the illuminance does not drop before 16h. When the illuminance drops below 20 before 16h I can see in the trace log that it does not trigger because the time is not met. However it stops checking after this… It never checks again.

Is there a possibility to keep on checking until both are met?

I have tried some blueprints, I have tried with the repeat action, I have tried moving the trigger and conditions around but so far nothing seems to work, Can someone help?

My initial automation is as following:

alias: "Woonkamer & Bar - Verlichting Aan: Sensor"
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.sensor_woonkamer_illuminance
    for:
      hours: 0
      minutes: 2
      seconds: 0
    below: 20
condition:
  - condition: and
    conditions:
      - condition: time
        before: "22:00:00"
        after: "16:00:00"
action:
  - service: scene.turn_on
    target:
      entity_id: scene.bar_gedimd
    metadata: {}
  - service: scene.turn_on
    target:
      entity_id: scene.woonkamer_spots_ontspannen
    metadata: {}
mode: single

This may work:

alias: "Woonkamer & Bar - Verlichting Aan: Sensor"
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.sensor_woonkamer_illuminance
    for:
      hours: 0
      minutes: 2
      seconds: 0
    below: 20
  - platform: time
    at: "16:00:00"
condition:
  - condition: numeric_state
    entity_id: sensor.sensor_woonkamer_illuminance
    below: 20
  - condition: time
    before: "22:00:00"
    after: "16:00:00"
action:
  - service: scene.turn_on
    target:
      entity_id: scene.bar_gedimd
    metadata: {}
  - service: scene.turn_on
    target:
      entity_id: scene.woonkamer_spots_ontspannen
    metadata: {}
mode: single

Thank you! I will try and let you know.

Hi it looks like its working so far! Thanks again.