Hc-sr501 PIR Motion detection

Hello Guys,

i have an PIR Sensor that is cabled like that:


in the middle is the output 0 or 3,3 V. For motion detected (3,3V) and no motion detected (0V)
I have this code in my configuration.yaml:

binary_sensor:
  - platform: rpi_gpio
    ports:
      4: Wohnzimmer

now my Question:

In the GUI of Home Assistant is now this:
and it is turned on? why?

There is no motion… and if i go in the area of the sensor it does not turn to off (or to on) whatever.
Does i configured the right port? Does i have to configure something in the configuration.yaml or in the autmations.yaml to detect motion?

Thx for help!

Hello there,
You should try adding: invert_logic: true and play around with it. That should help.

1 Like

Hello Antonio_Santos,

my sensor is still no detecting motion…
But ive fixed this switch on of thing with invert logic. Thx

Fixed the detect motion thing!
Reversed GND and Voltage haha …

1 Like

I know it is an old post but decided to try :slight_smile:
I have the same sensor and the same problem (always ON or always OFF with invert logic).

I connect VIN to 5V and GND to GND. The central pin of the sensor (DATA) to port 14.

What exactly you did to resolve this? Connected VIN pin of the sensor to GND on Raspberry and GND of the sensor to 5V?