Using a LUX entity for turning on lights

Hi, I’m using the automation described below.

How can I prevent that when you after the automation activated the light and you’ll turn it off it won’t go on again the same day? Or when the lux value is going up again and down

Does any have have a good suggestion?

Thanks!

alias: Lightsensor 20 Lux (WOONKAMER)
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.lichtsensor001_light_level
    above: 0
    below: 20
condition:
  - condition: time
    after: "15:00:00"
    before: "23:00:00"
  - condition: state
    entity_id: input_boolean.vakantie_programma
    state: "off"
  - condition: state
    entity_id: binary_sensor.lichtsensor001_lux_sensor_status
    state: "on"
action:
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: light.woonkamer_woonkamer_265
mode: single

i think maybe setting a condition that the automation is only run once per day might do it? something like the last condition i added below?

alias: Lightsensor 20 Lux (WOONKAMER)
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.lichtsensor001_light_level
    above: 0
    below: 20
condition:
  - condition: time
    after: "15:00:00"
    before: "23:00:00"
  - condition: state
    entity_id: input_boolean.vakantie_programma
    state: "off"
  - condition: state
    entity_id: binary_sensor.lichtsensor001_lux_sensor_status
    state: "on"
  - condition: template
    value_template: "{{ this.attributes.last_triggered.day != now().day }}"
action:
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: light.woonkamer_woonkamer_265
mode: single

Thanks for the input. This will suit

1 Like