Outdoor Automated Gate sensor

For the past year I’ve been looking for a reliable sensor to alert me if my main gate is left open. I have tried the Bangood GS-WDS07 using MQTT which was OK but too many fails. I recently tried the WIFi version of the Sonoff device which is hopeless, just goes to sleep. The Tuya sensor is excellent but there is no way of getting it working with HA.
I have reliable Wifi connection at the gate but its too far for ZWave or Zigbee.
I am ideally looking for a battery powered WiFi device but could get power there with some hassle, need to make a waterproof enclosure. I would probably need something that works with a reed switch.
Also the gate is automated and I notice the gate controller has a two wire flashing light output when open, perhaps this could be used.
Any advice really appreciated as this is driving me crazy.
Thanks