I decided to design my own remotely controlled fence/gate lock based on ESPHome and Home Assistant. I have a double gate which meant most commercially available solutions wouldn’t work and were very expensive. This solution is based on readily available components and is simple to assemble and install.
You can find the 3d printable enclosure, gate pin and customizable design files at Remote Gate Lock by jshank | Download free STL model | Printables.com.
The 3d files make up the enclosure and “pin” that threads into the linear actuator and acts as the lock hasp. I only needed to run 2-wires to the linear actuator outside while keeping the micro-controller and relay in the garage. There is a channel between the enclosure and lid that I filled with 3/32-Inch Graphite Valve Stem Packing to prevent liquid from entering the enclosure. The linear actuator is IP54 rated so this gives it just a bit more protection. The gate already has a magnetic contact sensor so I know when it’s closed and don’t trigger the automation until it’s closed.
Components List
- DC HOUSE Mini Electric Linear Actuator Stroke 2"–Force 4.5 lbs–12V | High-Speed 1.97"/sec–Weight 0.15KG
- NO to 12V +
- COM to linear actuator
- NC to 12V-
- D5 to Relay IN1
- D6 to Relay IN2
- GND to 12v GND
- 5V to MP1584EN output
- Set to 5v from 12v (potentiometer)
- VIN+/- from 12V power supply
- VOUT to Wemos
- No need to cut the barrel jack off of the power supply
Wiring
ESPHome Configuration
switch:
- platform: gpio
name: "gate_lock"
id: relay_lock
pin: D5
restore_mode: ALWAYS_OFF
interlock: [relay_unlock]
on_turn_on:
- delay: 1.5s
- switch.turn_off: relay_lock
internal: true
- platform: gpio
name: "gate_unlock"
id: relay_unlock
pin: D6
restore_mode: ALWAYS_OFF
interlock: [relay_lock]
on_turn_on:
- delay: 1.5s
- switch.turn_off: relay_unlock
internal: true
lock:
- platform: template
name: "North Gate Lock"
unlock_action:
- switch.turn_off: relay_lock
- switch.turn_on: relay_unlock
lock_action:
- switch.turn_off: relay_unlock
- switch.turn_on: relay_lock
optimistic: true
assumed_state: true
As an Amazon Associate I earn from qualifying purchases. I get commissions for purchases made through links in this post.