ZWave Mouse Trap

Problem:
Heard a few mice deep in our attic. Checking traps daily would require army crawling in and out of the attic repeatedly, likely for nothing at most times. Just a few mice can become a very big and potentially expensive problem FAST; an issue every home owner should never ignore!

Thought:
Don’t attempt to “build a better mouse trap”, rather instrument a good one. Automate it and don’t pay a Pest Control company. Glue traps and poisons are nasty and inhumane; no way to tell how many of these little critters might be up there. There is one ZWave enabled mouse trap available today I came across, but it uses AA batteries and not C’s (the later should last 3x as long), plus I stumbled across some fairly bad reviews of it. During my research I found this HA project for inspiration (props @ JeremyC!):

Objectives:
Using OpenHAB and ZWave door sensor, instrument the Victor multi-kill trap. Victor does offer some smart WIFI enabled models, but I didn’t want yet another internet connected ‘thing’, and wanted deep integration with my existing home automation without dependencies on the ‘cloud’. Upon a ‘hit’, it should send a SMS alert, trigger Amazon Echo announcements; graph the results via the OpenHAB UI. Effectively allowing the home owner to better study and address their problems over time, as well as juxtapose other relevant metrics such as outside vs indoor temperatures.

Requirements:
-Victor M260 Indoor Multi-Kill Electronic Mouse Trap

-Fibaro FGDW-002-1 FGDW0021 Door/Window v2 with Temperature Sensor, Z-Wave Plus

-Obviously, a working OpenHAB (v3) installation with ZWave controller

Steps:
-Unbox & test the Victor multi-kill trap
-Unbox & test the ZWave sensor
-Remove 5 screws to remove the trap housing
-Attach magnet to rotating ‘door’ frame
-Using a screwdriver, etch the inside of the rotating door so you can see the ‘center’ with the housing back on
-Re-install the housing
-Move ZWave sensor around to find the ‘center’ (i.e. for best placement and maximum contact with the magnet)
-Mark the outside of the unit where the sensor should align
-Add the ZWave contact sensor as an OpenHAB ‘thing’. (FYI battery powered devices may need to be manually ‘woken’ repeatedly and take time to show up when scanning via the OH ZWave binding)
-Add the Zwave equipment to the Model
-Create a virtual ‘counter’ number Item in OpenHAB
-Create a new Rule with script (below) to take actions and update the counter
-Create a new Script to reset the counter to zero (MouseTrap1_Counter.postUpdate(0))
-Test test test, by placing the ZWave sensor near the magnet, and monitoring activity via OpenHAB Log Viewer
-Once notifications are working, affix the ZWave sensor to the trap housing

Example Rule:

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: ZWaveNode069FGDW002FibaroDoorWindowSensor2Attic_SensorDoor
      state: OPEN
      previousState: CLOSED
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/vnd.openhab.dsl.rule
      script: >-
        
        var count = MouseTrap1_Counter.getState() as Number

        var counter = count + 1 as Number

        MouseTrap1_Counter.postUpdate(counter)

        EchoPortable_Speak.sendCommand('Mouse Trap kill counter now at ' + counter);

        val mailActions = getActions("mail","mail:smtp:XXXXXXXXX") 

        mailActions.sendHtmlMail("5555555555@text.att.net", "Attic", "Kill Counter now at " + counter)
    type: script.ScriptAction

OUTCOME

-ZWave sensor instrumentation
-Incrementing kill counter
-Immediate notifications

TODOs:

-Develop a cool looking mouse trap widget for OpenHAB (last hit timestamp, current counter since reset, battery level, latest temperature, tamper alarms, sparkline, etc)
-Additional rule for ‘empty the bin’ reminder notifications every N hours after a confirmed kill
-Make it easy to reset the counter (i.e. trigger the trap reset script via UI and voice)
-“Alexa, when was the Mouse Trap last triggered?” and “Alexa, what is the current Mouse Trap counter?”
-Detect and report on possible malfunctions (i.e. sensor went from CLOSED to OPEN, but not back to CLOSED within a short time period, indicating its jammed)
-Fire up some deadmau5 videos! (j/k) :smiley:



3 Likes

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.