← Log

Making my electric gate smart

Wiring an SONOFF MINI-ZBD dry relay into the existing gate motor so I can open the driveway gate from my phone, and from Home Assistant.

The driveway gate, closed

Kuma and I have an electric sliding gate on the driveway that came with two chunky fobs and nothing else. This weekend I wired it into Home Assistant so it opens from my phone and even better; Apple CarPlay.

Warning

This is not a comprehensive guide

Where the idea came from

The weekend before this project, my gate decided to stop working completely. It would open, but it wouldn’t shut. To start with, for discloure, I am not an electrician or an electric gate expert.

Trying to find the fix myself, and taking apart the gate motor, it ultimately didn’t look too complicated. A few wires here and there, a receiver and a transmitter. The board looked fine, and was still receiving input signals from the button, and the fobs.

The BFT Merak ARES controller
The BFT Merak ARES controller

This is the boring part, turns out the transmitter is battery powered, so after confirming the current battery was out of juice, I swapped it for a new one

The one battery to kill it all
The one battery to kill it all

Warning

Do not use a standard 1.5 V alkaline battery where a 3.6 V lithium battery is meant to go… Don’t ask.

The bits

Wiring it in

Obviously turning off the power at the mains for the gate before I did any work, Kuma and I took the Wago connectors and put the active L and N cables that were already going into the board, into those Wagos.

We then took the PVC cabling, stripped it down to the right lengths and send put one output into the existing board port, and one into the dry relay (matching the BFT board). This was the same for both L and N.

Lastly, we needed to sort out the signal - port 60 and 61 were responsible for the existing signalling for the gate. COM went into port 60 and NO went into 61. We didn’t need to use Wagos for the signalling ports, we can directly feed both the fob signallers and the SONOFF signaller into the same ports.

The Dry Relay and Wagos in full swing
The Dry Relay and Wagos in full swing

Once this was all in place, we taking cover turned back on the power and was pleased to see that the fobs still worked, and interacting directly with the relay opened the gate. Success!

In Home Assistant

Adding the gate was easy enough as any Zigbee device to Home Assistant, but there was one major flaw - the dry relay didn’t support limitless power - meaning the power is either always on or off; which is not great for a signal.

In Home Assistant, a simple automation solved this which triggers to turn off the relay after 1 second when it’s turned on.

alias: Gate 1-Second Auto-Off Failsafe
description: Ensures switch.gate always turns off after 1 second
triggers:
  - entity_id: switch.gate
    to: 'on'
    for:
      seconds: 1
    trigger: state
actions:
  - action: switch.turn_off
    target:
      entity_id: switch.gate

Now we have a simple switch to open the gate!

Gate Controller
Gate Controller

Using it with Apple CarPlay

Home Assistant already has a support CarPlay app, but the problem comes into play that you can only control home assistant on the same network - and when using CarPlay, it connects to the car.

Luckily for me, Nuba Casa has a remote offering. Whilst we could of used a VPN, for the small price monthly that supports the team behind Home Assistant, it felt like a win win.

Once added the button as a direct widget for Apple CarPlay, I can now open the game directly from my CarPlay.

Apple CarPlay x Home Assistant Widget
Apple CarPlay x Home Assistant Widget

What’s left