June 30th, 2024

Automating my gate door via a smart relay

The article details automating a gate door without remote capabilities using a smart relay, integrating it with HomeKit via Home Assistant. It covers setup, HomeKit benefits, and tips for stable integration.

Read original articleLink Icon
Automating my gate door via a smart relay

The article discusses how to automate a gate door without remote capabilities using a smart relay and integrate it into HomeKit via Home Assistant. The author describes their experience with automating their sliding gate system using a smart relay connected to the gate motor's I/O ports. They explain the process of setting up the relay, integrating it with Home Assistant, and exposing it to HomeKit for remote control via iPhone and CarPlay. The author also shares insights on using a door sensor for more stable integration and the benefits of HomeKit integration, such as using Siri commands and CarPlay buttons to operate the gate door. They express satisfaction with the automation setup and provide tips on tools used during installation and addressing latency issues with Zigbee connectivity. Overall, the article serves as a guide for individuals looking to automate gate doors using smart relays and home automation platforms.

Link Icon 6 comments
By @kelnos - 10 months
Love stuff like this. Years ago I lived in an apartment building where the main entrance was controlled by an analog phone system with an extra pair of wires. All the handsets in the unit were connected to a speaker/microphone outside the door (directly; there was no enable/disable when your unit was or was not getting buzzed), and there was an extra pair of wires for activating the door unlock.

I wanted to give my partner (and houseguests) the ability to come and go as they pleased without having to give them a building key (I only had one spare key provided by my landlord, and it was expensive to replace if lost). I bought a relay and grabbed an old Raspberry Pi, hooked the relay to the Pi's GPIO pins, and opened up the intercom phone and found the wires that activated the door unlock. Wrote a little HTTP server in python that would enable the GPIO pins for 10 seconds to unlock the door, and wired that up to my home automation system (openHAB). I got a Twilio phone number, and set it up so it would respond to particular PIN codes from specific phone numbers. When I was hosting someone for a weekend, I'd generate a random 8-digit PIN code and add that and their phone number to a config file on the Pi.

At the time I hadn't realized there were smart relays; otherwise this maybe would have required less work. This was 6 years or so ago, though, so maybe they weren't really a thing back then.

By @amluto - 10 months
A couple observations:

1. These gate systems usually have dry contact outputs as well, and you can get the gate motor’s idea as to whether the gate is open. You’ll need a smart relay with inputs :)

2. Home Assistant’s “cover” entities are a bit silly in that they don’t let you open a cover that is already 100% open. If you have a gate with an automatic close timer, you might want to send the open command even when it’s open to delay closing. You can fudge this by reporting the cover 99% open when it’s open instead of 100% open.

By @jnaina - 10 months
Took a slightly different approach for my gate, about a decade ago. Took apart one of the RF controller fobs, and wired it using a cheap relay from Aliexpress, and hooked it up to a Rpi's GPIO pins. Wrote a simple python code to control the open/close using the WiringPi library, with Alexa control achieved via the HA Bridge open source Philips HUE bridge software. Added Siri/Homekit control using HomeBridge.

Recently added two cheap outdoor cameras from Aliexpress with HLS streaming capabilities (and PoE) and wrote a simple iOS app that offers two different views (inside and outside gate), with a simple toggle button to open/close the gate. Backend hosted on a cheap $8 per month OVH instance with secure Tailscale access to the Rpi at home. This way, I can monitor my gate remotely from anywhere and open/close as required.

By @mk_stjames - 10 months
So all it takes to open this model of gate is someone to know to pry off that plastic motor cover thats only held on with 2 little screws, and short two pins of the connector right there on top which looks to be reachable through the bars of the gate from the other side.

I feel I'd want the motor controls in a more secured box if I was the type of person who needed one of these gates.

By @Animats - 10 months
All that electronics associated with the gate and you can't get info back about whether it's open, closed, moving, or blocked.
By @scottwick - 10 months
What happens if the 2nd signal (after the 200ms delay) is never received? Would keeping the relay closed like that cause any issues?

I wonder if a more "robust" way to handle this would be a custom microcontroller on the receiving end that receives a single Zigbee signal and implements the 200ms delay internally.