Ok, Maybe I've taken this whole Home Automation thing too far: HA friendly mouse trap

So, I’m trying to think of a way for HA to tell me when a mouse trap is tripped. I saw this video on how to make a mouse trap switch. I’m curious how to do this in a way that I can be alerted in Home Assistant when it’s triggered. Thoughts?

I have my HA instance installed on a Raspberry Pi, so you can use the GPIO to build a switch that HA can monitor. If you are not on a Raspberry Pi you can use Arduino to do the same thing.

That switch would not work if you were using the mouse trap to catch a mouse. The dead carcass would prevent the switch contacts from closing.

Agreed. I was thinking of more on the principle of a closed switch when the trap is triggered, but I’m not sure how to do this simply with HA, in a way that isn’t heavy on battery. Maybe a Sonoff or RF module?

Going on the assumption that the mouse trap is in a remote-ish location not hard-wired, but accessible via wifi, I would probably get an ESP8266, and write some firmware that writes an MQTT message on power-up then shuts itself down.

2 Likes

Put the switch on the other side and configure your pi or esp8266 to send an event when the switch goes ‘open’. ie: it is normally closed when the trap is armed and goes to open when something trips it.

In fact, if you use two contacts, one on either side, you can have HA tell you when the trap is armed, and when the trap is tripped. This tells you 3 things: ready to catch a critter, caught a critter, or time to add more peanut butter and reset the trap.

1 Like

So from a hardware perspective I need:

  • contacts for the switch
  • a way to transmit status
  • a way to power the device that transmits the status.

I found this project (a mail notifier) that is similar in function. That being said, I just realised because I’m close to an outlet, I wouldn’t necessarily need battery power.

How about just attaching a mini Z-Wave door sensor to the side of the trap?

You can attach the magnet to the side of the trap and the sensor could either just lay next to it or be attached to the wall.

Use this to send your GPIO states to HA via MQTT:

1 Like

Possibly :slight_smile: I think this would work that way. But I think I’m heading more towards building something myself, if only to learn more about building my own devices.

The z-wave idea is awesomely simple. And I have several unused door/window switches lying around.

1 Like

Or buy the zwave enabled mousetrap: https://domeha.com/blog/meet-the-mouser-the-worlds-first-z-wave-electric-mousetrap

Could u use a ESP8266 chip and Send a signal when for exemple pinn D5 and ground touch? So just install the ESP under the trap and then have two jumper wires that touch when it catch a mouse?

1 Like

Can’t wait to see what uniquely unusual devices they come up with next. :joy::joy::joy:

How about using a Window- / Door-Sensor that is attached to the trap?

Exactly Daniel. I’ve got some ESP8266 chips on the way :slight_smile:

Well sort of. The only problem is that most door sensors use reed a reed switch. Typically they’re made of sealed glass. Granted my current traps are plastic, but I’m sure traditional wooden/metal traps are similar in the violence of the trap shutting as is my current traps. Almost every time it’s caught a mouse, it’s laying upside down because of the violence of the trap shutting so quickly. My guess is that a a mouse trap built with a reed switch wouldn’t be very durable. I still feel like t*he basic switch built in the “prank video” would be the best. Or something between that and this project.

I still feel like there’s three main hardware components here, being:

  • mousetrap
  • the notification system
  • and the power to the notification system.

I’m working out slowly how to make that happen.

The sensors I have are magnetic and two pieces. The larger holds the batteries and could be stuck to a baseboard or other heavy object like a block of wood. The smaller piece simply houses a magnet that, when in close proximity to the sensor, results in a “closed” status. This piece could be attached to any part of the trap (that wouldn’t crush the magnet, of course), or affix the trap to a piece of cardboard with the magnet stuck to the cardboard.

Any time a mouse triggers the trap, the trap goes flying and would move the trap and magnet away from the base sensor. So I’d really be checking that the trap moved and not that the trap was actually triggered. But that works for me…

And so it begins…lol

1 Like

My first Arduino project was this rat trap. It captures the rats alive. I had not really thought through what to do when the rats eventually were trapped… It was a mess, to be honest :slight_smile:

If I ever make a MK II , I will probably use CO2 to humanly put them out of their misery.

I use a z-wave door sensor to alert when the trap is triggered. In the video It is not yet hooked up to z-wave.

Edit: The Dropbox video does not seem to embed correctly in the post. Here is the link:

Dropbox - Rottefella_v.0.8b.mp4 - Simplify your life

I ended up using some Zigbee door/window sensors with the zha component and Pushbullet for notifications on my phone. It’s nothing fancy, but it works and just in time for mouse season… Two mice down!

Three traps are set up so far, each with its own automation for alerting so I know which trap has been tripped.

I tested with the traps on cardboard, but when triggered they didn’t reliably move away from the sensor unit, so I ended up not using any extra wood or blocks or cardboard and just taped with masking tape the small magnet piece of the sensor to the trap. When these things are tripped the whole thing goes flying, mouse and all. The magnet is taped to the end where the arm goes when the trap is set, not the end where the mouse will be.

With a fresh battery, the magnet and sensor can be up to around 2" apart and still report as closed.

configuration.yaml:

########## Notifications #########
notify:
  - name: android_alerts
    platform: pushbullet
    api_key: secret-key-goes-here

I’m using Hass.io and made the automations in Configuration > Automation editor, hence the unique id numbers and “reversed” structure.

automations.yaml:

- action:
  - alias: Mouse in crawlspace
    data:
      message: Mouse in the crawlspace!
    service: notify.android_alerts
  - condition: state
    entity_id: binary_sensor.centralite_3300_03192834_1
    state: 'on'
  alias: Mouse in crawlspace - alert
  condition: []
  id: '1505613520729'
  trigger:
  - entity_id: binary_sensor.centralite_3300_03192834_1
    from: 'off'
    platform: state
    to: 'on'
- action:
  - alias: Mouse in garage by door
    data:                        
      message: Mouse by the garage door!
    service: notify.android_alerts
  alias: Mouse in garage by door - alert
  condition: []
  id: '1505765307932'
  trigger:           
  - entity_id: binary_sensor.sercomm_corp_tripper_00095ed9_1
    from: 'off'
    platform: state
    to: 'on'         
- action:                         
  - alias: Mouse in garage by steps
    data:      
      message: Mouse by the garage steps!
    service: notify.android_alerts
  alias: Mouse in garage by steps - alert
  condition: []
  id: '1505765429405'
  trigger:
  - entity_id: binary_sensor.sercomm_corp_tripper_00095ed7_1
    from: 'off'
    platform: state
    to: 'on'
1 Like