HassOS + Raspberry Pi 4 = no GPIO

Hi there,

Since I’m running HassOS on my new Raspberry Pi 4, I no longer receive input from the GPIO pins.
Up until the latest RC (HassOS 3.5) and the latest version of HA, never received any input.
Also, no errors whatsoever.

The pins do show up in the hardware overview:

Here’s my config:

  - platform: rpi_gpio
    ports:
      24: PIR Voordeur
    pull_mode: up
    invert_logic: false

  - platform: rpi_gpio
    ports:
      27: PIR Keuken
    pull_mode: up
    invert_logic: false

  - platform: rpi_gpio
    ports:
      26: PIR Zetel
    pull_mode: up
    invert_logic: false

  - platform: rpi_gpio
    ports:
      18: PIR Boven
    pull_mode: up
    invert_logic: false

Same config on a Raspberry Pi 3B+ works perfectly.

Anyone having the same experience or knows how to solve this?

Thanks in advance!

i had my home alarm PIR running on rasp pi 3 for years - no issue.

moved to Pi4 4GB… copied exact GPIO config and most of my PIR didnt work… only some worked. It seems about 50% of my GPIO on Pi 4 DONT WORK … or maybe not as sensitive as Pi 3? or something

by trial and error i have my alarm running reliably on Pi4 now, however, i had to trial and error for working pins. it was a major pain.

the pins you have chosen on yours are BROKEN on mine. try 14, 3, 4, 5 (this is config pin numbers)

  14: Garage1
  3: Upstairs
  4: Garage2
  5: Lounge
  15: Laundry
  2: Kitchen
  8: Bed2
  7: Bed3
  0: Masterbed
  6: Study1
  9: BROKEN
  10: BROKEN
  11: BROKEN
  12: BROKEN
  13: BROKEN
  17: BROKEN
  18: BROKEN
  19: BROKEN
  22: BROKEN
  23: BROKEN
  24: BROKEN
  25: BROKEN
  26: BROKEN
  27: BROKEN

Thanks for your reply @morles82!

That’s bad news…
I will try the pins that work in your setup tonight and report back.

Hope this is a software issue @pvizeli can eventually fix.

Just registered to say that I had the exact same problem. Thanks to @morles82 for trying out all the pins!

looks like its referenced here too -

Where it looks like the “broken” GPIO pins aren’t set to the correct “pull up” default. im unsure if this is a Hassio or Pi4 problem to resolve. That’s beyond my capability. But good to know its not a physical hardware or manufacturing fault.
it seems to occur under both HassOS and Raspian+Docker+Hassio

Yeah it does happened for me for both Hassos and Raspbian so it must be Hassio issue. If you are running Raspbian, you can enable them manually on start up. I posted on it here: Pi 4 and Gpio Issues

Also created an issue about it here: https://github.com/home-assistant/hassio/issues/1331 so others can chime in as well there :slight_smile:

Hope you didn’t actually connect anything to pin0. It will work while Pi is running but during the reboot your pi wont boot as that pin is reserved for flashing firmware :joy:

I spent a day troubleshooting this

haha. did not know this . i do and its current working as expected including reboots.
maybe its OK as PIR? or maybe if i rebooted while the PIR is being triggered - then it would crap out.
I just went from HassOS to Raspian+Docker+Hassio with SSD and all still working including reboots.

i might try and fix the other pins and move off Pin0 asap

You are probably not grounding it when its active. Mine was set up as a simple reed switch so when the window is closed it was grounded. According to this you should only use the green ones: https://miro.medium.com/max/2625/1*QlSyHfcfNu4ePpNoNtKcZQ.jpeg
It’s pretty easy to fix other pins, you just got to manually turn them on, i posted how here

Thanks for that. I actually followed your Pi4 SSD guide a few days back. very clear and straight forward. love your work! Cheers

Hello,
I cannot even see a GPIO on the Hardware screen. Does anyone have any advice?
Regards,

Does anybody know it this is still a problem? I just fried two of my GPIO pins and had to move back to my 3+ because I was out of GPIO pins on my 4. It has plenty, but only few work.

I know I could install HA with docker on the 4 and use the rest of the GPIO pins, but I’m using so many addons that the easier solution is just to buy new PI 4.

I had a similar problem, which I just solved!

In /boot/config.txt I had:
dtoverlay=gpio-shutdown,gpio_pin=3,active_low=1,gpio_pull=up
This line caused the problem. The solution is to comment it out.
BTW, any attempts to use the gpis-shutdown overlay did not work for me anyway…
So, at least in my case this was the problem. Unless this line is commented, rpi_gpio does not work. I guess any other dtoverly that plays with GPIO may interfere with rpi_gpio.

Hei is there any UI for config, so people don’t need to waste time for writing config file ?