I always wanted to integrate my gate-motor with HA and now that I have a few days off, I made the time.
What I wanted to achieve:
1: Open the gate remotely and allow it to “Auto-close”
2: Open the gate and keep it open till I manually close it again.
(For those who have a Centurion Gate-motor and not know this, if you press and hold the remote button for 5 seconds, or till the gate pauses while opening, the gate will remain open till you manually close it)
3: Open the gate for pedestrians only.
4: Lock the gate so no remote or any other “Integration/Device” can open it. (This will be interlocked with my Alarm System. when the alarm is “Armed”, gate operation will be blocked)
5: See the “Status LED” to be aware of any fault conditions. (Low Battery, gate open ext… )
I used a D1, linear voltage regulator and a 4 Relay Board.
May add the following:
1: Battery Voltage
2: Open / Close limits to indicate gate Position.
My simple code, nothing smart just to make it work.
esphome: name: gate_d1 platform: ESP8266 board: d1_mini wifi: ssid: "your_wifi_network_name" password: "your_wifi_password" # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "Gate D1 Fallback Hotspot" password: "system_created_password" captive_portal: # Enable logging logger: # Enable Home Assistant API api: password: "chose_your_password" ota: password: "chose_your_password" # Open Gate - Gate Will Autoclose switch: - platform: gpio pin: D1 inverted: yes id: relay1 - platform: template name: "Open Gate - Auto Close" icon: "mdi:gate" turn_on_action: - switch.turn_on: relay1 - delay: 3s - switch.turn_off: relay1 # Open gate - Gate must be closed manually - platform: gpio pin: D2 inverted: yes id: relay2 - platform: template name: "Open Gate - Manual Close" icon: "mdi:gate" turn_on_action: - switch.turn_on: relay2 - delay: 6s - switch.turn_off: relay2 # Open gate Pedestrian only - platform: gpio pin: D3 inverted: yes id: relay3 - platform: template name: "Open Gate - Pedestrian" icon: "mdi:gate" turn_on_action: - switch.turn_on: relay3 - delay: 2s - switch.turn_off: relay3 # Lock Gate at night - platform: gpio pin: D4 inverted: yes id: relay4 name: "Lock Gate" # Status LED binary_sensor: - platform: gpio pin: number: D0 mode: INPUT_PULLUP inverted: no name: "Status LED"