Raspberry Pi and PIR sensor

Hi all

I changed the file configuration.yaml according to the pattern from: https://www.home-assistant.io/integrations/rpi_gpio/
It looks like this:

binary_sensor:
  - platform: rpi_gpio
    ports:
      22: PIR hall

Why does it show high status in the dashboard if I haven’t connected anything? I measured the voltage on pin 22 and it shows 3.3V

Przechwytywanie

How to connect the PIR sensor HC-SR501 there, which will be activated, has 3.3V

I’m doing something wrong. Please help.

The default is for pull-up resistors to be enabled. You want to change this to pull_mode: DOWN for your particular circuit construction. See: https://www.home-assistant.io/integrations/rpi_gpio/#pull_mode

Thanks for the answer
I tried, but the pin is still 3.3V

binary_sensor:
  - platform: rpi_gpio
    ports:
      22: PIR hall
    pull_mode: “DOWN”

I also added the line “invert” and got low in the dashboard

binary_sensor:
  - platform: rpi_gpio
    ports:
      22: PIR hall
    invert_logic: True
    pull_mode: “DOWN”

Przechwytywanie

Unfortunately, this pin 22 still has a voltage of 3.3V
Any more suggestions? :slight_smile:

With this config (and after a restart):

binary_sensor:
  - platform: rpi_gpio
    ports:
      22: PIR hall
    pull_mode: DOWN

And with nothing connected to the pin, it should be 0v. If it is not, either there is an issue with the gpio integration or your gpio port is damaged.

Thanks for another quick reply.
There is 0V on the pin :slight_smile: I gave 3.3V voltage and the state changed into the dashboard :slight_smile: Thanks beautiful.

I will ask about one more aspect.
Sometimes, after disconnecting the voltage from the port, the dashboard still shows high status. An average of one in eight starts.

This is known issue. It has been around for three years and unfortunately does not look like being fixed any time soon. See:

There are alternatives. I use flyte’s gpio to mqtt server on another pi instead of using home assistant’s gpio integration.

I started learning. Is it possible to control GPIO pins via MQTT on the same Raspberry without additional devices? Everywhere I see configuration examples for additional devices, e.g. ESP8266.

Maybe if you did a supervised install on Raspbian, though home assistant is a bit “clingy” about retaining exclusive control of the gpio port. Shouldn’t be an issue if you don’t use any gpio integrations.

I do not understand why this problem was not addressed. Home Assistant is great, but this bug is terribly problematic. Raspberry has so many GPIO pins and I can’t use them as input. I will try https://www.openhab.org/ with it maybe everything will work as it should.

I’m also not familiar with all these configurations and maybe that’s a problem too :slight_smile:

Thanks for the answers and help :slight_smile:

1 Like