I was actually able to get the sensor and the magnet to work together with the enclosure. It required a bit of dremeling and some thinner double sided tape (inside the enclosure). I then used some strong 3M double sided tape to hold both the magnet to the deck post and sensor/enclosure to the metal gate. The magnet itself is not weatherproofed. I may fill it with silicone at some point. Thanks for all the suggestions! Hopefully this helps someone out. Here is what I ended up with:
