Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!

CHAI Acts as a Smart Espressif ESP8266 Gateway Between Home Assistant and CAME Gates

Integrating with the existing CAME controller, this Home Assistant bridge offers status monitoring, remote control, and a "postman" mode.

Mononymous maker Vince, of YouTube channel Dirt Cheap Hacks, has put together a bridge between Home Assistant and a CAME-brand powered gate system β€” using an Espressif ESP8266 microcontroller to deliver both control and monitoring in one.

"I have a parking gate with a CAME BXV controller and wanted to fully integrate it with a home automation system," Vince explains of the project, in a blog post brought to our attention by Adafruit. "Using a good old [Espressif] ESP8266 and ESPHome, I can now exactly control the movements from Home Assistant, get feedback of the actual gate position and state, and control it remotely or set-up alarms in case it stays open for too long for example."

Sick of the behavior of a stock CAME gate controller, Vince has built something better: CHAI, the CAME to Home Assistant Interface. (πŸ“Ή: Dirt Cheap Hacks)

The desire for home automation integration, beyond simply "because you can," came from the awkwardness of the stock hardware. "The provided RF [Radio-Frequency] remote control has a limited range and you can never be sure the command has been received when you press the button from far away," Vince explains, "so you often end up clicking a second time, and if the first command was in fact received, the gate stops and you have to click again to close, again to stop, and one more time to get it to open again."

The heart of the project β€” dubbed CHAI, for the CAME Home Assistant Interface β€” is an Espressif ESP8266 microcontroller module, in this instance on a Wemos LOLIN D1-style development board, running the ESPHome firmware. This is wired through an N-channel MOSFET to button inputs on the CAME controller, with some pull-up and pull-down resistors as the stop button is normally-closed to the other normally-open buttons.

The gate's existing limit switch is wired to both the microcontroller and the CAME controller, and for movement monitoring a combination of time-based status and motor voltage observation through optocouplers is employed β€” "at first, I wanted to retrieve information from the encoder terminals," Vince explains, "however, I could not make sense of the observed signals." A free general-purpose input/output (GPIO) pin on the microcontroller is used to monitor the gate's infrared sensor for detected obstructions.

The resulting automation system can monitor the gate's movement, tell when it's open or closed, trigger opening and closing on-demand or on a schedule, detect obstacle warnings β€” and when the CHAI controller is unpowered, the gate can gracefully fall back to standard CAME controller operation.

There's even a bonus: "The 'postman' feature allows one to flip a switch in [Home Assistant] to trigger the following sequence to let a delivery guy leave a parcel inside: open gate partially/wait for one minute/close gate," Vince explains.

The project is documented in full, including wiring diagrams and the YAML configuration file, on Vince's blog.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles