#Motion Light Logic

1 messages · Page 1 of 1 (latest)

split sage
#

Hi, I created an automation to turn on some lights when my motion detector sences someone is in the room or it gets dark enough and then to turn off if the brightness is above a certan lever or nobody is detected for 30 min. With how I have it not, the light will turn on fine but it never turns off. I don't know why this is nor how to fix it. I have been messing with this for the past week with no luck.

description: ""
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.lnlinkha_e04b41018010000000000000deac0000
    to:
      - "on"
    from:
      - "off"
  - trigger: numeric_state
    entity_id:
      - sensor.lnlinkha_e04b41018010000000000000deac0000_l
    below: 2
    for:
      hours: 0
      minutes: 0
      seconds: 10
conditions:
  - condition: time
    after: "04:15:00"
    before: "23:30:00"
  - condition: numeric_state
    entity_id: number.lnlinkha_e04b41018010000000000000deac0000_config_l
    below: 2
  - condition: state
    entity_id: binary_sensor.lnlinkha_e04b41018010000000000000deac0000
    state:
      - "on"
actions:
  - action: light.turn_on
    metadata: {}
    target:
      entity_id: light.kitchen_accent_lights
    data: {}
  - wait_for_trigger:
      - trigger: state
        entity_id:
          - binary_sensor.lnlinkha_e04b41018010000000000000deac0000
        for:
          hours: 0
          minutes: 30
          seconds: 0
        to:
          - "off"
      - trigger: numeric_state
        entity_id:
          - number.lnlinkha_e04b41018010000000000000deac0000_config_l
        above: 2
  - action: light.turn_off
    metadata: {}
    target:
      entity_id: light.kitchen_accent_lights
    data: {}
mode: restart
#

Here are the traces. I think the problem is the wait command. I want them to turn off if there is no motion for 30min OR when the brightness level is above the threshold. I think this is treating the wait command as a AND with the criteria. I don't know how to fix this though.

lone iron
#

wait for trigger waits for either of the triggers

distant pasture
#

I split a similar setup into 2 automations. The first with triggers for when to turn on, the second with triggers for when to turn off

granite lark
#

Triggers are always OR. As there is 0 chance 2 triggers (aka, an event without duration) will happen exactly at the same time to the fraction of a millisecond. And thus HA is not even trying to cover that.