Lux-based light automation not working

Hey everyone,

Been around the bend with this one, even though it seems so simple. Scenario is this:

When motion is detected, turn lights on with the condition that the lights are off and lux is below a certain threshold (20 lux). I’ve created a binary sensor for the luminance, and have confirmed it turns on when below the threshold. Also confirmed the motion detection is working. Trouble is, automation doesn’t fire. Wondering if I am missing something?

Various bits of YAML here:

Config.yaml

binary_sensor:
  - platform: threshold
    name: 'Luminence_Entry_LOW'
    entity_id: sensor.lumi_lumi_sensor_motion_aq2_89318a06_illuminance
    lower: 20

Automations.yaml

- id: '1619423099185'
  alias: Kitchen Lights on with Motion
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.lumi_lumi_sensor_motion_aq2_89318a06_ias_zone
    from: 'off'
    to: 'on'
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: light.kitchen_lights
        state: 'Off'
      - condition: state
        entity_id: binary_sensor.luminence_entry_low
        state: 'on'
  action:
  - type: turn_on
    device_id: be866dee1539070dc2ce08a5c5a308cc
    entity_id: light.kitchenlightonelt
    domain: light
    brightness_pct: 75
  - type: turn_on
    device_id: 9e5fa0eab2b00a854a935c0129701e8a
    entity_id: light.kitchen_light_two_lt
    domain: light
    brightness_pct: 75
  - type: turn_on
    device_id: 76d818c71f6af2ec3652259f3f73483b
    entity_id: light.kitchen_light_three_lt
    domain: light
    brightness_pct: 75
  - type: turn_on
    device_id: 28ede2f8c089dba154789f1d2861a3b6
    entity_id: light.kitchen_light_four_lt
    domain: light
    brightness_pct: 75
  - type: turn_on
    device_id: f176c895156b46fd34a734a8807e52a1
    entity_id: light.kitchen_light_five_lt
    domain: light
    brightness_pct: 75
  mode: single

In plain English, I think it should work as …

→ Motion is detected
→ CHECK: Are lights OFF and Binary Sensor ON?
→ If both pass, turn on all of the listed lights

Obviously I’m missing something, so any help would be greatly appreciated.

EDIT: I’ve also tried it with a numeric_state for the lux, but it still wouldn’t trigger.
Cheers

Change this:

        state: 'Off'

to this:

        state: 'off'

A light’s state value is on or off (all lowercase).

1 Like

Value of fresh eyes. I’m at work, but will try when I get home. Don’t see why this shouldn’t be the answer. Thanks!

EDIT: Wife checked for me. Working. Can’t believe I didn’t spot it lol. Thanks again!

1 Like

HiTom, bumped on this while searching for something similar.

FYI: conditions are always AND unless specified otherwise.