This is an addon to this mousetrap: https://www.homedepot.com/p/Harris-Catch-and-Release-Humane-Mouse-Trap-2-Pack-2EMT-LIVE/306929732 It will sit on top of the trap, can hold a DFRobot Firebeetle 2 ESP32 C6 development board (https://www.dfrobot.com/product-2771.html), 18650 battery and a DFRobot hall effect sensor (https://www.dfrobot.com/product-1310.html) to detect when the trap has closed. Just needs a couple of small magnets glued to the top of the trap door so then when it's closed, the hall effect sensor can detect that and I have written some code to send a message via MQTT to my Home Assistant which then sends a message to my phone via Telegram.
I used the Arduino IDE to write the code, a copy of which I attached here for you to modify as you like. You'll need to edit at least the wifi name and password, as well as the MQTT server name and password. You might also want to change the topic it writes. It also outputs battery voltage, although TBH I haven't found this particularly useful yet as it needs to be calibrated and I have not done so yet. ;]
The code will read the hall effect sensor state, attempt to transmit it via MQTT, and then go to sleep for 10 minutes to conserve battery power. It's not perfect, but I've had this running for over 4 weeks (actually turns out I hadn't fully charged the 18650 for that run - it will actually do ~3 months on a single charge, thanks to it going into deep sleep 10 minutes at a time).
Designed this in OnShape, model is available for you to modify freely at https://cad.onshape.com/documents/c3cd60087f92277b9fa5e34f/w/68d31b6acf19cd6a029e1752/e/c695f4171e67c90c097c89c1
It was my first time doing CAD, so the model is pretty crappy I'm sure. You've been warned! ;]
The author marked this model as their own original creation.