One Remote, Two Gates: Cloning My Garage Opener Onto My Front Gate With ESP32 and ESPHome


My garage remote has four buttons and I only used three. Instead of carrying a key for the front pedestrian gate, I taught that lonely fourth button to open it — so now a single remote handles both entrances, and the gate is also fully controllable from Home Assistant.

The idea. Most cheap multi-button 433 MHz remotes (the “universal” clone type) use fixed-code chipsets — PT2262 or EV1527 — that transmit the same static code on each button press, no rolling code or encryption. That’s a security weakness in general, but it’s exactly what makes this build possible: any 433 MHz learning receiver can latch onto the static button pattern and fire an output whenever it sees it again.

The hardware. I used a DFRobot Gravity 433 MHz Digital Wireless Receiver (4 channels, D0–D3, on-board learn button and helical antenna). To pair, you press the receiver’s button, press a remote button, and that button is now bound to a channel — took about ten seconds. From there:

  • Gravity D1 output → small NPN transistor + 10 kΩ base resistor → ESP32 GPIO 18. The transistor is a level-shift: the Gravity output is 5 V logic and the ESP32 GPIOs aren’t 5 V tolerant, so wiring them directly would slowly kill the pin.
  • ESP32 GPIO 5Songle SRD-5VDC-SL-C relay module (active-low), whose COM/NO contacts are in series with the gate’s electric strike.
  • The whole board is powered straight from mains with a Hi-Link HLK-PM01 (5 V), so there’s no external wall-wart.
  • Everything lives on a 6×8 cm perfboard with screw terminals for the AC input and the strike output, in a small acrylic enclosure.

Total cost was around 25–30 € and it took an afternoon.

The firmware. It’s a short ESPHome config. The relay pulse is owned by the switch (a 200 ms on_turn_ondelayturn_off), and the binary sensor reading the receiver just calls switch.turn_on when the remote fires — single source of truth, no duplicated timing logic. The receiver input is debounced with delayed_off / delayed_on_off filters of 100 ms each, because 433 MHz on a noisy receiver can chatter and you don’t want the relay machine-gunning on one press.

The Home Assistant bonus. Because the ESP32 stays on WiFi and registers via the ESPHome integration, the gate shows up as a switch entity the moment you flash it. That gets me, for free: a toggle on the dashboard, phone control, voice control, geofence/NFC automations, and timestamped logging of every open — whether it came from the remote or from HA. The original wired button inside the house still works (it’s in parallel with the relay), the remote still works, and HA works. Three independent paths to the same gate, none stepping on each other.

Honest caveats:

  • Fixed-code 433 MHz is replayable with a cheap SDR. For a property gate I’m comfortable with that; for a front-door deadbolt I would not do this — use a rolling-code or properly authenticated lock.
  • Mains is mains. The Hi-Link sits centimetres from low-voltage logic. Fuse the input, keep creepage distances generous, and if you’re not confident with AC wiring, just use an external 5 V supply instead.
  • No state feedback yet. I can trigger the gate but can’t read open/closed. A reed switch exposed as a binary_sensor with device_class: door is the obvious next step, and would unlock “notify if left open” type automations.

Full write-up with wiring details, the complete YAML, and photos: https://medium.com/p/8d0a14647ccb

So you "share" a project behind a paywall?
Probably allowed, but extremely frustrating... :face_with_steam_from_nose:

just added more details!