DIY remote front gate sensor using an MQTT Event trigger

I have a couple use cases for detecting when my house front gate is opened. At night, opening the gate triggers the front porch lights. During the day, I know when packages arrive. When I’m away, I get a picture of the front gate from my doorbell camera.

Here are notes on using a battery powered ESP-01s to notify when the house front gate is opened. It took a few iterations to get right, including switching from XBee3 Zigbee devices and ruling out BLE. In the end, it’s surprisingly reliable with good battery life. Simple wins.

Overall, pretty fun project and easy to automate with HA:

Lab Notes | Remote front gate sensor


I applaud people who do stuff and then document it for the benefit of others.

I am a little curious though as to whether esphome would have “just worked”?

Yep, esphome probably would have just worked :slight_smile:

Ah well you learned something and most importantly documented it.

Nice write-up.

Is your gate motorised? The reason I’m asking is that you can power things from it. I’m might have missed that point.

I had similar use cases, so during our first covid lockdown I built a device for this purpose too. In my case I stepped down the voltage from the gate motor’s 12V, powering an ESP32. I have WiFi coverage at my gate, which was another benefit. Plus, I’m tapping the gate’s open/closed sensors. Lastly I used ESPHome and recently switched my devices from using MQTT to using HA API instead. I’m finding it a lot more stable and responsive.

No, mine isn’t motorized. Would have been great to do what you did tapping the gate power like that.

It’s interesting you have lower latency and better stability without MQTT.