Rain sensor
thingiverse
Here's what you can do: Buy the sensor that can be bought using Amazon or Banggood, print its base to fit your fence column, then print its cover. Inside the cover is where you'll find the frame for assembling the sensor's PCB - use silicone to make it waterproof. Glue the sensor's PCB in place, connect all wires and glue the electronic PCB too - also using silicone this time. Once done, cover the entire pcb with more silicone. Next, put the wires through a hole in the base and assemble both parts. It fits perfectly in your case, just apply a little force and it works great.
With this file you will be able to print Rain sensor with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on Rain sensor.