ESPHome: binary_sensor GPIO => keep status for x time

Hi everybody,

is there a way to “safe” the current binary_sensor status on ESPHome for a set period of time? I am using an RCWL-0516 radar sensor, and it seems to constantly change between on and off. The relevant parts of my code are

      number: D1
      inverted: yes
    name: Gelb
    id: gelb

  - platform: gpio
    pin: D0
    name: "Radar"
    device_class: motion
      - invert
        - switch.turn_on: gelb
        - switch.turn_off: gelb


As you can see here, it keeps toggling within seconds; those periods of time where it doesn’t toggle right away, I have been re-flashing the ESPHome

I have found delayed_on_off (and delayed_on / delayed_off), however, those seem to only toggle the sensor, if it has been set to a certain state for a set period of time; I, however, would like the sensor to turn on as soon as it detects motion; but I also want it to stay on after detecting motion for, for example, one minute before toggling back to off. Can this be achieved?

Thank you for your ideas :slight_smile:

Well, the delayed_off filter should do that - turns on immediately when motion is detected, and delays turning off by 60s after no motion has been detected.

      - delayed_off: 60s
1 Like

This may not be relevant to your case, but I have found that sensor to be incredibly twitchy to the point where the use case for me was severely limited. On the face of it, a motion sensor that can punch through walls sounds genius, but then you find it’s reacting to people downstairs, and the tree outside, and birds flying past.

And also, you need to put a capacitor filter on the signal input, otherwise it will be triggered by the wifi of the ESP8266. And even with a filter installed, it needs to be a good 30-40cm away from the ESP.

All in all, no fun. I bought six of them, they’re all back in the drawer.

1 Like

Thank you @exxamalte you are absolutely right. I didn’t quite think this through yesterday.

@DeeBeeKay that’s true. I didn’t consider it measuring through objects. This will not work, especially in this case, where it is installed to an outside wall (from the inside, but it will likely pick up everything that’s going on outside). I am currently trying to build a multisensor and didn’t have regular PIR sensors in my parts drawer. Just ordered a bunch and will not use the radar ones for this, instead go with the regular PIR :slight_smile:

1 Like