Is there a better way to do Lux based lighting then this?

Hi everyone.

I am trying to wrap my head around how to build a intelligent lighting setup in my home.

Goal:
My presence sensor that sits in the living room constantly checks Lux value and turns the lights on / off based on a mix of lux value + whether there are people present in the room.

Problem:
Right now I have the setup as below for turning the lights on, but it doesn’t always react and sometimes I need to force the lights on because they don’t come on when I want.

So is there a better way then setting it up like this:

alias: Stuen - Tænd lyset i dagstimerne (Turn Lights On in Living Room)
description: ""
trigger:
  - type: present
    platform: device
    device_id: ba07b1773442cfe9880543de19114841
    entity_id: 703b820edc79510d0d4fd9daede0eb34
    domain: binary_sensor
condition:
  - condition: and
    conditions:
      - condition: state
        entity_id: input_select.hus_tilstand
        state: Hjemme
      - type: is_illuminance
        condition: device
        device_id: ba07b1773442cfe9880543de19114841
        entity_id: sensor.sensor_stuen_illuminance_lux
        domain: sensor
        below: 15
      - type: is_present
        condition: device
        device_id: ba07b1773442cfe9880543de19114841
        entity_id: 703b820edc79510d0d4fd9daede0eb34
        domain: binary_sensor
action:
  - service: light.turn_on
    data:
      brightness_pct: 60
    target:
      entity_id: light.stuen_lys
mode: single
alias: Stuen - Sluk lyset i dagstimerne (Turn off lights in the living room)
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.sensor_stuen_illuminance_lux
condition:
  - condition: and
    conditions:
      - condition: state
        entity_id: input_select.hus_tilstand
        state: Hjemme
      - type: is_illuminance
        condition: device
        device_id: ba07b1773442cfe9880543de19114841
        entity_id: sensor.sensor_stuen_illuminance_lux
        domain: sensor
        above: 20
      - condition: numeric_state
        entity_id: sun.sun
        attribute: azimuth
        above: 0
        below: 240
      - type: is_not_present
        condition: device
        device_id: ba07b1773442cfe9880543de19114841
        entity_id: 703b820edc79510d0d4fd9daede0eb34
        domain: binary_sensor
action:
  - service: light.turn_off
    data: {}
    target:
      entity_id: light.stuen_lys
mode: single

Hi Mikkel, welcome to the forum!

The trigger would be the lux value and the condition if someone is home/present.
This works:

trigger:
  - platform: numeric_state
    entity_id: sensor.kitchen_illuminance_lux
    for:
      hours: 0
      minutes: 0
      seconds: 10
    below: 40
    id: lightlow

condition:
  - condition: state
    entity_id: input_boolean.somebody_is_home
    state: "on"

action:
  - if:
      - condition: trigger
        id:
          - lightlow
    then:
      - if:
          - condition: state
            entity_id: light.livingarea
            state: "off"
        then:
          - service: light.turn_on
            data:
              brightness_pct: 10
              transition: 30
            target:
              entity_id: light.livingarea

Be aware that ‘Conditions’ are always AND unless specified.

1 Like