i wanted to know when my wooden backyard fence's gates are open, so if the mowers or poop scooper people leave it open, i'll know with automation. these are ugly and low effort, but they work. these are for wooden fences, and the holes are countersunk for flathead wood screws. if your gate's gap is pretty tight, you can use the single-piece magnet holder (aqara_magnetic_small_magnet.stl), but if your gap is larger like on my fence, you should probably print the 2-piece magnet base and lid, as i designed the magnet to protrude out about 10mm, so the screws can go into your 4x4 fencepost, but the magnet can stick out a little to make the gap smaller. when mounting, pay attention to the models, for the sensor, one wall is much much thinner. the side on the sensor with the vertical line on it should face that side. on the magnet, the vertical goes in first when you push the magnet into the holder. the magnet won't need waterproofing as it's literally just a magnet. the larger sensor part i left some extra space inside so you can get a sandwich bag and wrap it up to keep water and moisture out. these are really rough and ugly models with loose tolerances, so just about any printer settings should work. the lid for the sensor needs supports. i print it upside down, and support the “ears”.
if you need a model of the sensor and magnet, i sketched them up and you can download the STL's here: https://www.printables.com/model/471865-aqara-magnetic-door-sensor-models
The author marked this model as their own original creation.