Wire a Shelly Plus Uni or a Sonoff dry-contact relay in inching mode to your gate motor's trigger input, power it from the motor's battery-backed 12 V, add a reed contact for status, and get a Home Assistant gate with a left-open alert and a confirm-first open.
Almost every South African driveway has a sliding gate with a Centurion D5 or D10, or something similar, behind a pillar. The remotes work, but they cannot tell you whether the gate is still open when you are already in bed, and they cannot let a family member in while you are at work.
In this post we add a small dry-contact relay - a Shelly Plus Uni, or a Sonoff in inching mode - to the motor's low-voltage trigger input, so Home Assistant can send the same short "button press" as a remote. Then we add a magnetic reed contact for open or closed status. You end up with a proper gate entity, a left-open alert, and an arrive-home prompt that only opens the gate after you confirm on your phone.
Safety first
- Never auto-open without confirmation. Opening the gate when your phone gets home can let in the wrong person, or fire because your location jumped. Every open in this post needs a tap on an unlocked phone.
- Follow the manufacturer's wiring. The D5-Evo manual says to cut power and disconnect the batteries before any work, and not to modify the system. We only use the existing low-voltage terminals.
- Mains work is for an electrician. The D5-Evo runs from mains (or a low-voltage supply on the Low-Voltage model) with a battery behind it. The manual recommends a licensed electrical contractor. Nothing here touches the mains side.
- Keep the remotes working. The relay sits beside your remotes and intercom, not instead of them. If Wi-Fi or Home Assistant is down, the gate must still work.
- Safety beams stay. Do not bridge or remove the infrared safety beams to make automation "easier".
How the controller sees a trigger
On the Centurion D5-Evo, the Trg terminal is a normally-open, potential-free input. Momentarily connecting Trg to Com makes the gate open, close or stop, depending on the operating mode - the same as a remote or a push button, and what our relay will do.
Two details matter:
- It must be a short pulse. The relay has to close and then let go again, like a finger on a button. The D5-Evo troubleshooting table lists a latching input on Trg as a reason the gate does not move. So the relay must switch itself off again.
- One input does everything. The same pulse opens, closes or stops. Home Assistant cannot tell which one it will be from the pulse alone, which is why we add a status sensor and check it before every command.
Other motors (and the D10 family) have similar trigger and common terminals, but names and limits differ. Use your own manual's terminal table.
Option A: a Shelly relay
You need a relay with potential-free (dry) contacts that can run from the motor's 12 V.
- Shelly Plus Uni (our pick). Two solid-state dry-contact outputs and two digital inputs. Shelly lists 8-24 V AC or 9-28 V DC, use under 1 W, and outputs up to 30 V and 300 mA - plenty for a trigger that only needs a contact closure. A reed between an input and the Uni's GND gives you gate status.
- Shelly 1 Gen3. One dry-contact relay and one switch input. Shelly lists 110-240 V AC, 24-48 V DC or 12 V DC. Follow the 12 V DC diagram on Shelly's page.
- Shelly Plus 1. Also dry contact, but Shelly wants a stabilised 12 V DC supply within 10%. Check what your motor's aux output really delivers.
Powering the Shelly
The D5-Evo has an Aux 12V Out for "auxiliary equipment such as a radio receiver, photo cells, etc." The current manual limits it to 1 A; an older D5-Evo and D10 guide lists 300 mA. Check your own manual and add up everything already on that terminal. The Uni uses under 1 W.
We follow the manual's radio-receiver diagram: Aux 12V Out to the Uni's red VAC1 wire, and Com to the black VAC2 wire. If your manual does not allow extra devices on the aux output, use a separate low-voltage DC supply in the Uni's range, fitted by someone qualified.
A relay on the aux output keeps working through load-shedding, provided your Wi-Fi and Home Assistant are on backup power.

Wiring it up
- Switch off the mains isolator and disconnect the battery, as the manual says.
- Connect Aux 12V Out to the Uni's VAC1 (red) and Com to VAC2 (black).
- Connect the two OUT1 wires to Trg and Com. The contacts are potential-free, so they behave like a push button across those terminals.
- Mount a reed (magnetic) contact with the switch on the post or wall and the magnet on the gate, lined up when the gate is fully closed. Run its wires to IN1 (orange) and GND (green) on the Uni.
- Put the Uni in a small enclosure inside the motor cover, away from moving parts, and reconnect the battery and mains.
The D5-Evo also has a Status output for an LED, with flash codes for movement, no mains and a low battery. It is meant for LEDs, not a smart-relay input, so we use a reed contact instead.
Set up the Shelly
- Add the Uni to your 2.4 GHz Wi-Fi and update the firmware.
- In the Uni's web interface, open Output 1 and turn on Auto off. We start with 1 second - our starting value, not a Centurion figure. If the gate ignores the pulse, try a little longer.
- Set Output 1's input mode to detached, so the reed contact does not switch the relay. In Shelly's API this is in_mode: "detached" means the input does not affect the output.
- Set Input 1 to Switch mode (not Button), so the reed holds a state.
- Give it a fixed IP address on your router.
Home Assistant entities
Add the device with the Shelly integration (usually discovered automatically). For Gen2 and newer devices, a binary sensor appears for an input only when the Input Mode is set to Switch. Rename them to switch.gate_relay and binary_sensor.gate_closed_contact, or use your own names.
Open and close the gate with a remote and watch the binary sensor. A reed that closes when the magnet is near should read on when the gate is closed. If yours is reversed, swap "on" and "off" in the YAML below.
A gate entity (template cover)
A template cover with device_class: gate gives you a gate card. Home Assistant's garage-door example checks the state first so one button cannot do the wrong thing. We do the same: "open" only pulses when closed, and "close" only when open.
template:
- cover:
- name: Front gate
device_class: gate
state: >-
{{ 'closed' if is_state('binary_sensor.gate_closed_contact', 'on') else 'open' }}
open_cover:
- condition: state
entity_id: binary_sensor.gate_closed_contact
state: "on"
- action: switch.turn_on
target:
entity_id: switch.gate_relay
close_cover:
- condition: state
entity_id: binary_sensor.gate_closed_contact
state: "off"
- action: switch.turn_on
target:
entity_id: switch.gate_relay
We left out a stop button on purpose: with one trigger, a "stop" pulse at the wrong moment could start the gate instead. The cover shows "open" for a partly open gate, because one reed only knows closed or not.
Automations
1. Left-open alert
This notifies your phone when the gate has been open for 10 minutes, with a "Close gate" button that only works on an unlocked phone (authenticationRequired). It checks again that the gate is still open before it pulses, and uses a unique action name for each run, as the Companion docs recommend.
alias: "Gate left open"
mode: single
triggers:
- trigger: state
entity_id: cover.front_gate
to: "open"
for: "00:10:00"
actions:
- variables:
action_close: "{{ 'CLOSE_GATE_' ~ context.id }}"
- action: notify.mobile_app_your_phone
data:
title: "Front gate still open"
message: "The gate has been open for 10 minutes."
data:
actions:
- action: "{{ action_close }}"
title: "Close gate"
authenticationRequired: true
- wait_for_trigger:
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: "{{ action_close }}"
timeout: "00:15:00"
continue_on_timeout: false
- condition: state
entity_id: cover.front_gate
state: "open"
- action: cover.close_cover
target:
entity_id: cover.front_gate
Ten minutes and the fifteen-minute wait are starting values. If the controller already has autoclose, this alert is a backup.
2. Arrive-home confirm-first open
When you enter the home zone and the gate is closed, Home Assistant asks if it should open. Nothing happens unless you tap "Open gate" on an unlocked phone within three minutes.
alias: "Arriving home: offer to open the gate"
mode: single
triggers:
- trigger: zone
entity_id: person.you
zone: zone.home
event: enter
conditions:
- condition: state
entity_id: cover.front_gate
state: "closed"
actions:
- variables:
action_open: "{{ 'OPEN_GATE_' ~ context.id }}"
- action: notify.mobile_app_your_phone
data:
title: "Welcome home"
message: "Open the front gate?"
data:
actions:
- action: "{{ action_open }}"
title: "Open gate"
authenticationRequired: true
- wait_for_trigger:
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: "{{ action_open }}"
timeout: "00:03:00"
continue_on_timeout: false
- condition: state
entity_id: cover.front_gate
state: "closed"
- action: cover.open_cover
target:
entity_id: cover.front_gate
Make the home zone big enough that the prompt arrives before you stop at the gate, but do not let the automation open by itself. Location can be late or wrong.
Option B: a Sonoff relay in inching mode
A Sonoff dry-contact relay can send the same short pulse as the Shelly. The reed contact, left-open alert and confirm-first open still apply: point switch.gate_relay at the Sonoff switch.
- SONOFF MINI-D (MINI Dry). Dry-contact Mini with NO, COM and NC, powered from 100-240 V AC or 12-48 V DC (never both at once). Power it from Aux 12 V Out to DC+ and Com to DC-, then wire NO and COM across Trg and Com. Use NC and COM if your motor needs a break rather than a make.
- SONOFF RE5V1C. Tiny 5 V dry-contact module with inching or self-locking modes in eWeLink. Step the motor's 12 V down with a buck converter; do not feed it 12 V.
- Older Sonoff SV. Officially 5-24 V, so it can run from the aux 12 V. ITEAD's guide puts it in isolated mode after you remove two resistors.
Do not wire a Mini R4, Basic or other live-switching Sonoff across Trg and Com. Those switch mains, not a dry contact.
In eWeLink, open the device, tap the three dots, enable Inching Settings, set Auto-off, and start with 0.5 to 1 second (Sonoff's garage-door guide uses 0.5 s; we used 1 s on the Shelly). The module then pulses itself.
In Home Assistant, install the SonoffLAN custom integration (AlexxIT, via HACS), add it with your eWeLink account, prefer auto mode, and just turn the switch on. The MINI-D can also join via Matter for on and off; set inching in eWeLink first. To drop eWeLink, flash a module with Tasmota (PulseTime 10 = 1 s; 1-111 are 0.1 s steps) or ESPHome (turn the GPIO off after a short delay).
Testing
- Pulse the relay from the Shelly web interface or by turning the Sonoff switch on. The gate should move once, and the Trg LED should flash then go off.
- Open and close the gate with a remote. The binary sensor should follow it.
- Try the gate card: "open" when closed, "close" when open.
- Test the notifications with the phone locked and unlocked.
- Switch off Wi-Fi for a moment. The remotes must still work.
Troubleshooting
- The gate does not move. Check the Trg LED. If it stays on, the relay is not switching off: check Auto off on the Shelly, or Inching on the Sonoff. If it never lights up, check your wiring to Trg and Com.
- The gate moves when the reed changes. The input is still linked to the output. Set the input mode to detached.
- No binary sensor in Home Assistant. Set the input to Switch mode, then reload the Shelly integration.
- The relay drops off during load-shedding. Your router and access points need backup power too. A trigger on the relay going "unavailable" makes a handy offline alert.
Sources
- Shelly Plus Uni: https://kb.shelly.cloud/knowledge-base/shelly-plus-uni
- Shelly 1 Gen3: https://kb.shelly.cloud/knowledge-base/shelly-1-gen3
- Shelly Plus 1: https://kb.shelly.cloud/knowledge-base/shelly-plus-1
- Shelly API, Switch (auto off, in_mode): https://shelly-api-docs.shelly.cloud/gen2/ComponentsAndServices/Switch
- Home Assistant Shelly: https://www.home-assistant.io/integrations/shelly/
- Home Assistant Template cover: https://www.home-assistant.io/integrations/template/
- Actionable notifications: https://companion.home-assistant.io/docs/notifications/actionable-notifications/
- Centurion D5-Evo installation manual: https://www.centsys.co.za/pdf/prod/d5-evo/1010.D.01.0001%20D5-Evo%20Manual%2009052024_AP_Web.pdf
- Centurion D5-Evo/D10 configuration guide: https://www.centsys.com.au/pdf/D5-Evo/1010.D.01.0003%20D5-Evo%20D10%20D10%20Turbo%20Configuration%20Guide%2029062018BM.pdf
- SONOFF MINI-D docs: https://help.sonoff.tech/docs/mini-d
- SONOFF garage-door guide (0.5 s inching): https://help.sonoff.tech/docs/How-to-automate-a-garage-door
- SONOFF RE5V1C: https://sonoff.com.cn/product/sonoff-re5v1c-5v-wifi-inching-selflock-relay-module/
- SONOFF SV isolated mode: https://itead.cc/wp-content/uploads/2023/03/SV.pdf
- eWeLink inching: https://help.ewelink.cc/hc/en-us/articles/4402778321421-The-Ultimate-Guide-to-Inching-Feature
- SonoffLAN (AlexxIT): https://github.com/AlexxIT/SonoffLAN
- Tasmota PulseTime: https://tasmota.github.io/docs/Commands/#control