Esphome deep sleep problems with ESP32 and RCWL-0516 Motion Sensor

Hi there, I’m trying to build a battery powered motion sensor with RCWL-0516 and ESP32 (both power by battery).
I connected the radar out to gpio and configured this pin as “wakeup” for the deep sleep mode - this works as expected.

- platform: gpio
        number: GPIO26
        mode: INPUT_PULLUP (<- tried with and without)
     device_class: motion
     name: espradar

    run_duration: 30s
    sleep_duration: 10min
    wakeup_pin: GPIO26
    id: deep_sleep_1

Additionally, I let the ESP wake up every 10 minutes - but when it wakes up according to schedule (not by high signal / motion detection of the sensor) the esp32 is detecting a motion (or at least the configured switch toggles to ON).

Every wakeup (without any motion next to the sensor) the following messages are transmitted in this order:

  1. Radar sensor from OFF to ON
  2. Status switch from OFF to ON
  3. Radar sensor from ON to OFF
  4. Status switch from ON to OFF -> Deep Sleep for another 10 minutes

Any idea how to stop this behaviour when waking up from deep sleep if no motion occurs?

Try using mqtt instead of the api to communicate with home assistant. Define a blank/empty LWT message.

Hey @tom_l - I’m using MQTT for this project.
The “last will” or the esphome status isn’t the problem - it’s the radar input pin sending “motion detected” values without any motion when waking up from deep sleep.

Are you sure it’s going from off to on and not unavailable to on?

idk what’s the difference here.

I don’t want a “motion detected” message every time the device wakes up according to schedule but ONLY when a real world motion is detected.

Right now I’m getting “motion detected” every 10 minutes when the device wakes up.

The part where the device exits deep sleep BECAUSE real motion is detected works great.

It’s just the scheduled wakeup which generates an additional motion alert without any motion next to the sensor.

The difference is that the sensor wont go to unavailable when the device sleeps if you include a blank LWT message.

GPIO26 should be ok to use it’s not one of the ones that goes high on boot.

As far as I can tell - this solution with INPUT_PULLDOWN seems to work:

- platform: gpio
        number: GPIO26
        mode: INPUT_PULLDOWN
     device_class: motion
1 Like

Hey @codegrau can you share more info about the design of your battery powered motion sensor? Very interested in putting one together!