having issues with an automation for turning off the lights either based on light level or once presence isnt detected. The auto on was simple enough and works but I cant get them to turn back off when the light level is above the threshold or presence is gone. below is the config
alias: Living room lights auto off
description: ""
triggers:
- trigger: numeric_state
entity_id:
- sensor.presence_sensor_fp2_c25a_light_sensor_light_level
above: 35
conditions:
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.presence_sensor_fp2_c25a_presence_sensor_1
state: "off"
actions:
- action: light.turn_off
metadata: {}
data: {}
target:
device_id:
- d5be0ab01d3c8b0f20548cf21dcd74b9
- aa579f57db4883481d679cb587f99238
mode: single
If the conditions are or then you do not need the conditions. The fact that either one triggers already implies the corresponding condition is true. Only if both conditions need to be true then you need both the conditions and the triggers. Because if one trigger happens, the other condition might still be false.
I just don’t want the lights to turn out while were in the room at night but also want them to turn off at a certain light level even if we are in the room. I hope that makes sense. With that being said would this code work for what I am trying to achieve?
alias: Living room lights auto off
description: ""
triggers:
- trigger: numeric_state
entity_id:
- sensor.presence_sensor_fp2_c25a_light_sensor_light_level
above: 35
- trigger: state
entity_id:
- binary_sensor.presence_sensor_fp2_c25a_presence_sensor_1
to: "off"
conditions: []
actions:
- action: light.turn_off
metadata: {}
data: {}
target:
device_id:
- d5be0ab01d3c8b0f20548cf21dcd74b9
- aa579f57db4883481d679cb587f99238
mode: single
Or would i be better off setting two different automations for this?