# WeatherHat: Failed to add edge protection

**URL:** <https://forums.pimoroni.com/t/weatherhat-failed-to-add-edge-protection/19832>\
**Category:** Support\
**Created:** [July 11, 2022, 1:11pm UTC](https://forums.pimoroni.com/t/weatherhat-failed-to-add-edge-protection/19832 "2022-07-11T13:11:15Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ceewolf](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@ceewolf](https://forums.pimoroni.com/u/ceewolf)\
**Post date:** [July 11, 2022, 1:11pm UTC](https://forums.pimoroni.com/t/weatherhat-failed-to-add-edge-protection/19832/1 "2022-07-11T13:11:15Z")

</div>

I have just received the Weather Hat from Pimoroni.  
I have been battling to get the weather.py or any other code to run. I have started with a fresh install and tried on various Raspberry Pi 3’s. I keep getting the following error:

RuntimeError: Failed to add edge detection.

I am starting to think that the Hat is faulty, any help please?

---

<div class="post-metadata">

**Author:** ![ceewolf](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@ceewolf](https://forums.pimoroni.com/u/ceewolf)\
**Post date:** [July 11, 2022, 1:12pm UTC](https://forums.pimoroni.com/t/weatherhat-failed-to-add-edge-protection/19832/2 "2022-07-11T13:12:46Z")

</div>

![Screen shot](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/e/e812b8c196252316436cc2ac77b7b7fcafc4bb2c.jpeg)

---

<div class="post-metadata">

**Author:** ![hel](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/hel/32/6075_2.png) [@hel](https://forums.pimoroni.com/u/hel)\
**Post date:** [July 11, 2022, 1:46pm UTC](https://forums.pimoroni.com/t/weatherhat-failed-to-add-edge-protection/19832/3 "2022-07-11T13:46:10Z")

</div>

Are you using Pi OS Lite? If so, you might need to `sudo apt install python3-pip git libatlas-base-dev` to grab the extra dependencies.

(and then possibly run our installer again - I can’t remember if that was necessary)

---

<div class="post-metadata">

**Author:** ![ceewolf](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@ceewolf](https://forums.pimoroni.com/u/ceewolf)\
**Post date:** [July 11, 2022, 1:50pm UTC](https://forums.pimoroni.com/t/weatherhat-failed-to-add-edge-protection/19832/4 "2022-07-11T13:50:39Z")

</div>

Hi  
Nope not using Pi OS Lite, using the full version.

---

<div class="post-metadata">

**Author:** ![hel](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/hel/32/6075_2.png) [@hel](https://forums.pimoroni.com/u/hel)\
**Post date:** [July 11, 2022, 2:12pm UTC](https://forums.pimoroni.com/t/weatherhat-failed-to-add-edge-protection/19832/5 "2022-07-11T14:12:32Z")

</div>

Hmm, did you get any errors when you ran the installer?

---

<div class="post-metadata">

**Author:** ![ceewolf](https://avatars.discourse-cdn.com/v4/letter/c/48db29/32.png) [@ceewolf](https://forums.pimoroni.com/u/ceewolf)\
**Post date:** [July 11, 2022, 2:43pm UTC](https://forums.pimoroni.com/t/weatherhat-failed-to-add-edge-protection/19832/6 "2022-07-11T14:43:44Z")

</div>

None at all. I have done a few fresh installs, each time the same?

---

<div class="post-metadata">

**Author:** ![miekie2](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/miekie2/32/9895_2.png) [@miekie2](https://forums.pimoroni.com/u/miekie2)\
**Post date:** [June 17, 2023, 5:22pm UTC](https://forums.pimoroni.com/t/weatherhat-failed-to-add-edge-protection/19832/7 "2023-06-17T17:22:50Z")

</div>

I am having the same issue. Cant seem to find assistance anyhwere

---

<div class="post-metadata">

**Author:** ![JonathanGroves](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/jonathangroves/32/10833_2.png) [@JonathanGroves](https://forums.pimoroni.com/u/JonathanGroves)\
**Post date:** [May 31, 2024, 11:07am UTC](https://forums.pimoroni.com/t/weatherhat-failed-to-add-edge-protection/19832/8 "2024-05-31T11:07:38Z")

</div>

A year and no help with this?  
Fresh install of latest Raspbian and getting this error.  
Any help gratefully received.  
Error:

```auto
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

```

Code:

```auto
import weatherhat
import time

sensor = weatherhat.WeatherHAT()

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

```

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [May 31, 2024, 11:19am UTC](https://forums.pimoroni.com/t/weatherhat-failed-to-add-edge-protection/19832/9 "2024-05-31T11:19:02Z")

</div>

You can contact tech support by e-mail.  
[Contact Us for Raspberry Pi Technical Support - Pimoroni](https://shop.pimoroni.com/pages/contact-us)

---

<div class="post-metadata">

**Author:** ![JonathanGroves](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/jonathangroves/32/10833_2.png) [@JonathanGroves](https://forums.pimoroni.com/u/JonathanGroves)\
**Post date:** [May 31, 2024, 11:23am UTC](https://forums.pimoroni.com/t/weatherhat-failed-to-add-edge-protection/19832/10 "2024-05-31T11:23:19Z")

</div>

Thanks. Just seems a shame that more than one person has this issue and the conversation suddenly stopped.  
I’ll email and post back here with what emerges.

---

<div class="post-metadata">

**Author:** ![hel](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/hel/32/6075_2.png) [@hel](https://forums.pimoroni.com/u/hel)\
**Post date:** [June 5, 2024, 10:33am UTC](https://forums.pimoroni.com/t/weatherhat-failed-to-add-edge-protection/19832/11 "2024-06-05T10:33:51Z")

</div>

So sorry that this one fell off my radar!

This sounds somewhat like your error - might be worth checking that you don’t have anything else trying to use BCM 4 (or 1 wire enabled in `sudo raspi-config`)?:

> <https://github.com/pimoroni/weatherhat-python/issues/23>
>
> here below errors from terminal
> !\[Untitled-1\](https://github.com/pimoroni/weath…erhat-python/assets/123834271/fc4daec0-4c7a-435c-8bb1-eebd7b3d1e2a)
> !\[immagine\](https://github.com/pimoroni/weatherhat-python/assets/123834271/685c4ba5-97e8-4571-9925-58a1bcc56065)
