GPIO inputs not working with latest Octoprint #510

Open
opened 2025-10-30 10:57:24 +00:00 by StoneAgeSkillz · 4 comments
StoneAgeSkillz commented 2025-10-30 10:57:24 +00:00 (Migrated from github.com)

I'm running latest Octoprint on Rpi4. Fresh instalation of Octoprint, once with, once without backup restoration. Ame issue every time, GPIO inpust dont work:

Log from instalation without backup, one button and output setup:

2025-10-30 11:48:56,191 - octoprint.plugins.enclosure - INFO - Setting GPIO mode to BCM
2025-10-30 11:48:56,192 - octoprint.plugins.enclosure - INFO - Setting GPIO pin 4 as OUTPUT with initial value: 1
2025-10-30 11:48:56,192 - octoprint.plugins.enclosure - INFO - Adding GPIO event detect on pin 22 with edge: 32
2025-10-30 11:48:56,193 - octoprint.plugins.enclosure - WARNING - An exception of type RuntimeError occurred on log_error. Arguments:
('Failed to add edge detection',)
Traceback (most recent call last):
File "/opt/octopi/oprint/lib/python3.11/site-packages/octoprint_enclosure/init.py", line 1725, in configure_gpio
GPIO.add_event_detect(gpio_pin, edge, callback=self.handle_gpio_control, bouncetime=200)
RuntimeError: Failed to add edge detection

Log output from restored backup:

2025-10-30 10:58:26,602 - octoprint.plugins.enclosure - WARNING - An exception of type RuntimeError occurred on log_error. Arguments:
('Failed to add edge detection',)
Traceback (most recent call last):
File "/opt/octopi/oprint/lib/python3.11/site-packages/octoprint_enclosure/init.py", line 1725, in configure_gpio
GPIO.add_event_detect(gpio_pin, edge, callback=self.handle_gpio_control, bouncetime=200)
RuntimeError: Failed to add edge detection
2025-10-30 10:58:26,605 - octoprint.plugins.announcements - DEBUG - Loaded channel _octopi from cache at /home/martin/.octoprint/data/announcements/_octopi.cache
2025-10-30 10:58:26,615 - octoprint.plugins.enclosure - WARNING - An exception of type RuntimeError occurred on log_error. Arguments:
('You must setup() the GPIO channel first',)
Traceback (most recent call last):
File "/opt/octopi/oprint/lib/python3.11/site-packages/octoprint_enclosure/init.py", line 1818, in handle_initial_gpio_control
if (rpi_input['edge'] == 'fall') ^ GPIO.input(gpio_pin):
^^^^^^^^^^^^^^^^^^^^
RuntimeError: You must setup() the GPIO channel first

I think its the new Python, i2c OLED and Filament Scale stopped working too.

I'm running latest Octoprint on Rpi4. Fresh instalation of Octoprint, once with, once without backup restoration. Ame issue every time, GPIO inpust dont work: Log from instalation without backup, one button and output setup: > > 2025-10-30 11:48:56,191 - octoprint.plugins.enclosure - INFO - Setting GPIO mode to BCM > 2025-10-30 11:48:56,192 - octoprint.plugins.enclosure - INFO - Setting GPIO pin 4 as OUTPUT with initial value: 1 > 2025-10-30 11:48:56,192 - octoprint.plugins.enclosure - INFO - Adding GPIO event detect on pin 22 with edge: 32 > 2025-10-30 11:48:56,193 - octoprint.plugins.enclosure - WARNING - An exception of type RuntimeError occurred on log_error. Arguments: > ('Failed to add edge detection',) > Traceback (most recent call last): > File "/opt/octopi/oprint/lib/python3.11/site-packages/octoprint_enclosure/__init__.py", line 1725, in configure_gpio > GPIO.add_event_detect(gpio_pin, edge, callback=self.handle_gpio_control, bouncetime=200) > RuntimeError: Failed to add edge detection Log output from restored backup: > 2025-10-30 10:58:26,602 - octoprint.plugins.enclosure - WARNING - An exception of type RuntimeError occurred on log_error. Arguments: > ('Failed to add edge detection',) > Traceback (most recent call last): > File "/opt/octopi/oprint/lib/python3.11/site-packages/octoprint_enclosure/__init__.py", line 1725, in configure_gpio > GPIO.add_event_detect(gpio_pin, edge, callback=self.handle_gpio_control, bouncetime=200) > RuntimeError: Failed to add edge detection > 2025-10-30 10:58:26,605 - octoprint.plugins.announcements - DEBUG - Loaded channel _octopi from cache at /home/martin/.octoprint/data/announcements/_octopi.cache > 2025-10-30 10:58:26,615 - octoprint.plugins.enclosure - WARNING - An exception of type RuntimeError occurred on log_error. Arguments: > ('You must setup() the GPIO channel first',) > Traceback (most recent call last): > File "/opt/octopi/oprint/lib/python3.11/site-packages/octoprint_enclosure/__init__.py", line 1818, in handle_initial_gpio_control > if (rpi_input['edge'] == 'fall') ^ GPIO.input(gpio_pin): > ^^^^^^^^^^^^^^^^^^^^ > RuntimeError: You must setup() the GPIO channel first I think its the new Python, i2c OLED and Filament Scale stopped working too.
Markeno76 commented 2025-12-12 19:48:22 +00:00 (Migrated from github.com)

I can confirm the same issue. I did the troubleshooting for inputs putting in the python script recommended, and that works.. "Outputs" work, but not Inputs. I'm not at this time able to find any useful in sorting it. I have had 3 fresh instances setup, 2 on two different devices done with restoring, and a third fresh install starting from scratch and only adding the Enclosure plugin. Always getting the "RuntimeError:Failed to add edge detection".

I can confirm the same issue. I did the troubleshooting for inputs putting in the python script recommended, and that works.. "Outputs" work, but not Inputs. I'm not at this time able to find any useful in sorting it. I have had 3 fresh instances setup, 2 on two different devices done with restoring, and a third fresh install starting from scratch and only adding the Enclosure plugin. Always getting the "RuntimeError:Failed to add edge detection".
SteevyT commented 2026-01-05 16:24:40 +00:00 (Migrated from github.com)

I just did a move from a Pi 3 to a Pi 4 with a fresh install of the latest stable Octoprint and have the same issue outlined above. I tried several different pins to ground as my button input and none have worked.

I just did a move from a Pi 3 to a Pi 4 with a fresh install of the latest stable Octoprint and have the same issue outlined above. I tried several different pins to ground as my button input and none have worked.
Nacho-chz commented 2026-02-19 09:27:41 +00:00 (Migrated from github.com)

I have the same issue after updating my Pi 4 from OctoPi 1.0.0 to 1.1.0. GPIO outputs work fine, inputs not working at all.

I have the same issue after updating my Pi 4 from OctoPi 1.0.0 to 1.1.0. GPIO outputs work fine, inputs not working at all.
ahmaddxb commented 2026-03-03 07:51:02 +00:00 (Migrated from github.com)

Try my fork it is for the newer OctoPi versions, inputs are working now on my PI3

https://github.com/ahmaddxb/OctoPrint-Enclosure

Try my fork it is for the newer OctoPi versions, inputs are working now on my PI3 https://github.com/ahmaddxb/OctoPrint-Enclosure
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Gandalf/OctoPrint-Enclosure#510