Hello everyone,
I use an esp12s in a radar motion detector ZY-M201-24GWIFI which is connected to a tuya MCU. On datapoint 1 the MCU supplies three integer values (0 1 or 2):
0 is for no movement
1 is for movement
2 presence
I now want the ESP to deliver the string instead of the three integer values.
I tried it like this:
- platform: "tuya"
name: "${friendly_name} Movement"
icon: mdi:eye
sensor_datapoint: 1
filters:
- lambda: !lambda |-
if (x == 0) {return "nobody";}
But i get an error during compile:
<unicode string>: In lambda function:
<unicode string>:97:27: error: could not convert '"nobody"' from 'const char [7]' to 'esphome::optional<float>'
*** [.pioenvs/zy-m201-esp01/src/main.cpp.o] Error 1
No idea whats happend there, because i new to lambda. How can i archive this? Maybe there is a better way to do this.