Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Failed to add edge detection #28

Closed
JonathanGSL opened this issue May 31, 2024 · 3 comments
Closed

RuntimeError: Failed to add edge detection #28

JonathanGSL opened this issue May 31, 2024 · 3 comments

Comments

@JonathanGSL
Copy link

JonathanGSL commented May 31, 2024

This code:

import weatherhat
import time

sensor = weatherhat.WeatherHAT()

while True:
        sensor.update(interval = 0.5)
        time.sleep(1.0)

...produces this error:

Traceback (most recent call last):
  File "/home/pi/go.py", line 4, in <module>
    sensor = weatherhat.WeatherHAT()
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/.local/lib/python3.11/site-packages/weatherhat/__init__.py", line 80, in __init__
    self._ioe.on_interrupt(self.handle_ioe_interrupt)
  File "/home/pi/.local/lib/python3.11/site-packages/ioexpander/__init__.py", line 411, in on_interrupt
    self._gpio.add_event_detect(self._interrupt_pin, self._gpio.FALLING, callback=callback, bouncetime=1)
RuntimeError: Failed to add edge detection

Fresh install of latest Rasbian (no desktop) on Pi 4.

Any help gratefully received.

@Gadgetoid
Copy link
Member

This usually means the interrupt pin is in use by some other process or feature. Make sure 1-wire, for example, is not enabled in /boot/firmware/config.txt (or Raspberry Pi configuration interfaces menu) since that uses GPIO 4 by default.

Note: if you're feeling brave, it would be useful if you tried the code here: #29

@JonathanGSL
Copy link
Author

Away at the moment but will try when I get home. Thanks so much for an excellent, supporting response!

@Gadgetoid
Copy link
Member

Since the port to Pi 5 / gpiod this code is no longer present, so hopefully it works/still works for you with the new v1.0.0 version!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants