Hi,
i have a esphome node (esp8266) with a pir attached. This pir brings lots of false positives, but I found out that false motions are always very fast and motion goes back to no within half a second. when real motion is detected, duration is more than a second.
so I thouhgt, I could do something like this, so there is only a publish if the duration is more than half a second:
binary_sensor:
- platform: gpio
pin: D3
name: gang_sz_PIR
device_class: motion
#state_topic: gang_sz/motion
on_multi_click:
- timing:
- ON for at least 0.5s
then:
- logger.log: "PIR on"
- mqtt.publish:
topic: gang_sz/motion
payload: "on"
- lambda: !lambda |-
return "on";
However. Coming from fhem, I am pretty new to HA. Have been using esphome for two years or something, but using mqtt only.
Now I have two questions regarding publish:
-
how can I let the node publish a âmotionâ directly to HA using the API? The âreturn âonââ does not seem to change the value of the entity in HA. What is wrong here?
-
also using an mqtt switch and using a âmotion activated lightâ does not work. seems that âonâ is the wrong value here.
It would be very kind, if someone could tell me what I am doing wrong.
Best regards and thanks in advance,
Otto