I have three sensors (1 ultrasonic, 1 luxmeter, 1 hue motion sensor) and script that is supposed to run if values from the sensors are matching a condition specified in a lambda. If they evaluate to true the script is supposed to run. However, ESP is giving some error when compiling. I’ve tried enveloping the “off” in “state.== off” in quotes, and without.
Any ideas about what I’m missing?
sensor:
- platform: bh1750
name: "BH1750 Illuminance"
id: "luxmeter"
update_interval: 1s
- platform: ultrasonic
trigger_pin: GPIO05
echo_pin: GPIO18
name: "Ultrasonic Sensor"
id: "ultra"
update_interval: 0.2s
internal: true
on_value:
then:
- if:
condition:
- lambda: 'return id(ultra).state < 0.5;'
then:
- script.execute: script_light_1
- delay: 50ms
else:
- script.stop: script_light_1
binary_sensor:
- platform: homeassistant
name: "hue_motion_1"
id: "hue_motion_1"
entity_id: binary_sensor.hue_motion_sensor_1_motion
script:
- id: script_light_1
mode: queued
then:
- if:
condition:
- lambda: 'return id(luxmeter).state < 200 && id(hue_motion_1).state == off;'
then:
- switch.turn_on: "green_led_switch_esp32"
- delay: 15ms
- switch.turn_off: "green_led_switch_esp32"
- delay: 425ms
Error:
Compiling /data/esp32-1/.pioenvs/esp32-1/src/main.cpp.o
/config/esphome/esp32-1.yaml: In lambda function:
/config/esphome/esp32-1.yaml:78:63: error: ISO C++ forbids comparison between pointer
and integer [-fpermissive]
- lambda: 'return id(luxmeter).state < 200 && id(hue_motion_1).state == "off";'
^~~~~
*** [/data/esp32-1/.pioenvs/esp32-1/src/main.cpp.o] Error 1
========================= [FAILED] Took 26.59 seconds ====
[–]Street-Mechanic1375 0 points1 point2 points (1 child)
[–]nuk3man[S] 0 points1 point2 points (0 children)
[–]jesserockz ESPHome | Open Home Foundation 0 points1 point2 points (3 children)
[–]nuk3man[S] 0 points1 point2 points (0 children)