Gate sensor

I would like to be able to monitor gates to know if it’s been left open. This could alert you if there’s a trespasser or prevent a dog from running away. I’ve seen people try to waterproof the current sensor but it doesn’t make sense that this couldn’t be an option within a range of the house with decent WiFi.