Philips Hue Sensor + Illumiance Automation issue

Hi,
Is there anyone who can see what the heck i am doing wrong in this automation.
It worked until i tried to add the Illumiance.
I cannot see why the Illumiance don’t work?

I have tried to add it both in the “When” and in the “And If”, but nothing works.

This is my Automation code:

alias: Bryggers Light Control - Sensor Activated (25-01-2024)
description: Turn on light for 5min when movement is detected
trigger:
  - platform: state
    entity_id:
      - binary_sensor.bryggers_hue_motion_sensor
    to: "on"
  - platform: numeric_state
    entity_id:
      - sensor.bryggers_hue_motion_sensor_illuminance
    attribute: light_level
    below: 5
condition:
  - condition: state
    entity_id: sun.sun
    state: below_horizon
    enabled: false
  - condition: numeric_state
    entity_id: sensor.bryggers_hue_motion_sensor_illuminance
    enabled: false
    below: 5
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: light.bryggers_40283
            state: "off"
        sequence:
          - service: light.turn_on
            entity_id: light.bryggers_40283
          - service: script.turn_on
            target:
              entity_id:
                - script.lys_timer_5min
            data: {}
          - service: input_boolean.turn_on
            entity_id: input_boolean.allow_light_on
      - conditions:
          - condition: state
            entity_id: light.bryggers_40283
            state: "on"
        sequence:
          - service: script.turn_on
            target:
              entity_id:
                - script.lys_timer_5min
            data: {}
mode: restart

And this is the Script code:

alias: Light Timer Bryggers (5min)
description: 5min Light Timer for Bryggers
sequence:
  - delay:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
  - condition: state
    entity_id: input_boolean.manual_light_off
    state: "off"
  - service: light.turn_off
    entity_id: light.bryggers_40283
mode: restart
icon: mdi:timer-sand

The light is turning on, even when the Sensor Illumiance is at 18 lx, when testing.
Skærmbillede 2024-01-27 142838

Hope someone could help. :slight_smile:

Thanks.

I’m having a hard time following this, it’s so convoluted. There is a very short automation to turn on a light and leave it on for x minutes in the community guides. Try adding a simple illuminance condition to that.

i have now tried this, but it dosen’t turn off the light again?
It works, so the light is turning on, but does not turn off after the 1 min.

alias: TEST Movement
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.bryggers_hue_motion_sensor
    to: "on"
  - platform: state
    entity_id:
      - binary_sensor.bryggers_hue_motion_sensor
    to: "off"
    for:
      hours: 0
      minutes: 1
      seconds: 0
condition: []
action:
  - service: light.turn_on
    target:
      entity_id: light.kontor_alt_lys
    data: {}
mode: single

Did you try the automation I suggested? The light will stay on if movement continues in the room and only go off x minutes after movement stops. You don’t need a timer.

People can still read posts you delete, you know. :smile:

didn’t know :flushed:
I figured it out.
Needed to choose the philips Hue Sensor as a device and not entity, then it worked. :slight_smile:
Thanks for your help.