For anyone still using it, there’s a known error with the rpi_gpio add-on in HA OS 12.3:
In my case it showed up as none of the GPIO pins working, and the following in the log:
2024-05-09 09:19:45.265 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up rpi_gpio platform for binary_sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
await asyncio.shield(awaitable)
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/rpi_gpio/binary_sensor.py", line 97, in setup_platform
RPiGPIOBinarySensor(
File "/config/custom_components/rpi_gpio/binary_sensor.py", line 132, in __init__
edge_detect(self._port, edge_detected, self._bouncetime)
File "/config/custom_components/rpi_gpio/__init__.py", line 59, in edge_detect
GPIO.add_event_detect(port, GPIO.BOTH, callback=event_callback, bouncetime=bounce)
RuntimeError: Failed to add edge detection
I’m running on an RPi 3B+ but it looks like it also affects the RPi 4. I’ve also seen reports of this or a different GPIO problem the RPi 5, but I don’t know if/how that’s related.
Same for me: updating ha os from 12.2 to 12.3 breaks GPIO inputs.
Multiple reloads of gpio and reboot do nothing.
I had to downgrade to 12.2 to recover gpio
Raspi 4b with GPIO hat module.
Thanks
Eddy.
A couple of people have reported good luck with a new(er) fork of the RPi GPIO custom component:
I haven’t tried it yet, but that’ll be my next step. In the end I think I’ll just use an ESP8266 and ESPHome to read my GPIO inputs. It seems silly, with the RPi sitting there with all those unused GPIO pins, but it’s pretty clear HA has abandoned them.
I reverted to a backup 12.2 but I still have the same problem. GPIO inputs are not working. GPIO outputs are working. This is frustrating as HA evolved on using PI. Not a happy bunny here!
Thanks Eddy, greatly appreciated. I assumed wrong that a backup reverted to the OS version I was on. Copied your command and success.
GPIO is back working. Phew. Thnak You
I did try the gpio component linked above, and it worked. Unfortunately I ended up restoring all the way back to an earlier OS and Core, due to a series of problems. It started with a memory leak and crash, then severe performance issues and failures of a number of integrations. All of this happened after updating OS, Core and the GPIO component. After several days of attempts, with new things failing all the time, I was never able to identify which of those three changes (or maybe something unrelated) started everything.
Long story short: After making this change, keep an eye on your system and please report back here if you find anything odd.
I just restore my last backup Core-2024.5.4 on a fresh new sdcard with OS 12.3
remove old rpi-gpio from HACS
Install gpiod as custom repo in HACS, 2 x full reboot (OS)
Change the syntax in config with new syntax and reboot
All seems to work fine: no message in logs, cpu usage and ram ok
Just bouncetime: setting is refused when checking config so i bypass this setting, and all works fine. i’ll spy behaviour during next few days
On the right, you can see my slave raspi4 (HA2) who is hosting the GPIO hat.
CPU Load (5min) graphic. The average changed from about 0.9 to 0.1x after the change…
But as i changed: GPIO integration, OS (12.2 to 12.3), and the SDCARD : a noname brand to an sandisk EXTREME… i don’t know what makes such a big impact !