Hue motion sensor light level as trigger for automation

Hi,

I created an automation where motion and the light level of a hue motion sensor are configured as trigger.

The automation works as ist should, but I think there is a problem with the „light level below 1“-trigger. Even if the light level is above 1 lx the automation is turning on the lights. Am I using a wrong value?

Can someone help me?


alias: Badezimmer Nachtlicht
description: ""
trigger:
  - platform: state
    from: "off"
    entity_id:
      - binary_sensor.motion
    to: "on"
  - platform: numeric_state
    entity_id: sensor.light_level
    below: 1
    attribute: light_level
condition:
  - condition: not
    conditions:
      - condition: state
        entity_id: light.badezimmer_1
        state: "on"
action:
  - service: scene.turn_on
    target:
      entity_id: scene.badezimmer_nachtlicht
    metadata: {}
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - if:
      - condition: numeric_state
        entity_id: light.badezimmer_1
        attribute: brightness
        above: 10
    then:
      - stop: Licht manuell eingeschaltet
  - type: turn_off
    device_id: dda0f10a184ec55d7e53b53a2616e58b
    entity_id: light.badezimmer_1
    domain: light
  - type: turn_off
    device_id: 6e5648bd086539dfd0dc30efc566fe0d
    entity_id: light.badezimmer_2
    domain: light
  - type: turn_off
    device_id: 0a791ea33fde0e692918defecb1cc778
    entity_id: light.badezimmer_3
    domain: light
  - type: turn_off
    device_id: d61ec63f404a6a952b6d94dcf4e4f13a
    entity_id: light.badezimmer_4
    domain: light
  - type: turn_off
    device_id: 9b68b2e089f2c5870b2ed887f41e246a
    entity_id: light.badezimmer_5
    domain: light
  - type: turn_off
    device_id: a51d1e2340fa9785a739f76c11ee4f10
    entity_id: light.badezimmer_6
    domain: light
  - type: turn_off
    device_id: 801117c24019958a0d9927e5df70a239
    entity_id: light.badezimmer_7
    domain: light
  - type: turn_off
    device_id: bbbe35d59e9819a2a928b068c434a364
    entity_id: light.badezimmer_8
    domain: light
mode: single

I think I solved it by myself.

It seems, that the LUX value is only changed after some minutes or, when motion is detected.

I changed the Triggers as follows and now it seems to work as wanted:

trigger:
  - platform: state
    from: "off"
    entity_id:
      - binary_sensor.motion
    to: "on"
    for:
      milliseconds: 200
  - platform: numeric_state
    entity_id: sensor.light_level
    below: 5
    attribute: light_level
1 Like

Thanks for this info! So do I understand correctly, you added in the trigger that the motion needs to be active for at least 0.2s. So therefore you delay the whole automation by 0.2s and therefore give the illuminance sensor time to update to the correct value?

On a side note: did you also notice that the attribute light level seems to be the correct Lux value, e.g. 9831 in my example. But the state of the sensor.hue_motion_sensor_1_illuminance if I don’t set the attribute light_level is 9, which seems to be something like the lux value 9831 divided by 1000 and then truncated… I cannot explain it otherwise. See Screenshot:

(Concerning Hue Motion Sensor V2, probably the same for the V1)
So the two settings would probably be equal:

condition: numeric_state
entity_id: sensor.hue_motion_sensor_1_illuminance
below: 10000
attribute: light_level
condition: numeric_state
entity_id: sensor.hue_motion_sensor_1_illuminance
below: 10

Although I think only the state with the attribute light_level does make any sense since the state is too coarse for light detection (divided by 100). Please correct my if I assume wrongly.