I was recently at the movies and my phone started ringing off the hook. Two different neighbors were calling to say they saw my crazy dog running around outside the fence. I knew I needed a way to make sure my gates were closed. I read a few threads here and got some ideas, and I wanted to post up exactly what I did for anyone else who may want to do the same.
In short, I bought an Indoor/Outdoor, wide gap open/close sensor, paired it with a dry contact switch sensor, a waterproof project box and some screws/caulking. All in the job took 15 minutes per gate.
Chamberlain Wide Gap Bar Switch, $7.30, http://www.ebay.com/itm/160718042374
Estone Project Box Kit, $8.76, https://www.amazon.com/gp/product/B00JEWNKR0/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1
Aeotec by Aeon Labs ZW097 Dry Contact Sensor, Small, White, $34.95, https://www.amazon.com/gp/product/B0155HSUUY/ref=oh_aui_detailpage_o03_s01?ie=UTF8&psc=1
I started by connecting the Bar Sensor to the Dry Contact sensor and testing sensor placement. Once I found a good location I drilled a hole in the enclosure and threaded the wire through the box:
Then Mounted the sensors and the box:
Once I was satisfied with the location and sensor placement I put the Aeotec sensor in the enclosure, added a dollop of silicone at the opening and sealed it up tight.
Once all that was done I installed the custom device handler from this thread:
and I was in business.
Hope this helps!