Hi there,
my google did not found a hint for my rather simple problem. I have a ESP32 with light intensity sensor and a movement detector. The move-in detector shall only trigger the LED to on, if daylight is below 100 lux. And LED to off on move-out.
The LED is working on/off as expected when I remove the condition part. But honestly I am not even sure if I wrote the right syntax for the condition. Compiles, but light never goes on.
sensor:
- platform: bh1750
name: "Tageslicht Lux"
id: tageslicht_lux
address: 0x23
unit_of_measurement: "lx"
device_class: "illuminance"
state_class: "measurement"
binary_sensor:
- platform: gpio
pin: GPIO25 # BISS0001 with big fresnel lens
name: "Bewegung"
device_class: motion
filters:
- delayed_on: 2000ms # to render the AM312 behaviour
- delayed_off: 2000ms # to render the AM312 behaviour
on_press:
then:
if:
condition:
lambda: 'return id(tageslicht_lux).state < 100;'
then:
- output.turn_on: led_red
on_release:
- output.turn_off: led_red
light:
- platform: binary
name: "Red_LED"
output: led_red
output:
- id: led_red
platform: gpio
pin: GPIO26
inverted: true
What I am doing wrong?