This section is under development
GitHub : https://github.com/growboxguy/Gbox420/tree/master/ESPHome
This section is under development
GitHub : https://github.com/growboxguy/Gbox420/tree/master/ESPHome
This project allows you to control your gate or garage door using a virtual button in Home Assistant. It simulates a physical button press through a relay controlled by a Raspberry Pi Pico W running ESPHome. More information on: Home Assistant and ESPHome.
Here are the 3 key files in the GitHub repo:
gate.yaml: ESPHome configuration for the gate opener
gateDashboard.yaml: Sample Home Assistant dashboard setup
secrets_gate.yaml: Example secrets.yaml section. You can either:
Append it to your existing ESPHome secrets.yaml, or
Rename it to secrets.yaml if this is your first project, and then update the values accordingly.
Home Assistant dashboard card
Button that cycles through: Opening → Stop → Closing → StopInternal temperature sensor (needs calibration)Graph with past week's readingsRaspberry Pi Pico W
2 Mb flash26 × multi-function GPIO pins: 3 x Analog pins,In the gate or garage door opener's manual, locate the terminal pins and identify the one that starts/stops the motor, usually labeled as the Wall Control or Start/Stop button. Briefly shorting this pin to Common (Neutral) should start the motor. If successful, short the pin to Common again for a few seconds to verify that it stops the motor. If your garage door already has a manual open/close wall switch, connect the relay in parallel with it.
The provided code assumes the gate cycles through the following states: OPENING → STOP → CLOSING → STOP, then repeats.
Also, locate the neutral and phase wires of the incoming power line. These can be used to power a USB charger that runs the Pico W.
Follow these steps to set up your Gbox420_Gate dashboard in Home Assistant:
0. If you already have a dashboard, skip to step 9 and use only the cards section from the gateDashboard.yaml file
Go to Settings in Home Assistant.
Select Dashboards.
Click + ADD DASHBOARD.
Choose New dashboard from scratch.
Enter Gbox420_Gate as the dashboard name.
Save and switch to the new dashboard
Click Edit Dashboard in the top-right corner.
Select the three dots menu and choose Raw configuration editor.
Paste the contents from https://github.com/growboxguy/Gbox420/blob/master/ESPHome/gateDashboard.yaml
Save your changes.
Install Python and ESPHome:
Check if phyton is installed:
python --version
if not: Install it from the Python website, select "Add Python to PATH" and "Run as admin" during the installation, and restart once done.
Check if the Python package manager is installed:
pip --version
if not: Verify PATH variable exists C:\Users\USERPROFILE\AppData\Local\Programs\Python\Python313\
Install esphome:
pip install esphome
While the below command is running it will host the ESPHome dasboard under localhost: http://127.0.0.1:65420/
esphome dashboard ./ --port 65420 --open-ui
The dashboard can be used to:
Edit secrets.yaml
Create/Edit Devices
Verify Device YAML configuration
Compile firmware
Upload firmware via USB (first time) or Wirelessly (OTA update)
Check for updates (ESPHome or GitHub updates for external components)
If you run the above commands in the folder where https://github.com/growboxguy/Gbox420/tree/master/ESPHome is was downloaded, it will load every YAML file within the folder. The gateDashboards.yaml file is for the Home Assistant Dashboard, which includes the button card, and secrets_gate.yaml should be pasted into the SECRETS section (top right corner). After that, you can remove all other files and only keep the device configuration file Gate.yaml.
In this guide I'll focus on compiling and uploading the device firmwares using ESPHome CLI instead of the ESPHome dashboard.
Change passwords:
Rename secrets_gate.yaml to secrets.yaml (or merge into existing secrets.yaml)
Update WiFi SSID, WiFi password, Encryption key, and OTA passwords.
Set static IP (optional):
In gate.yaml under the wifi section uncomment the manual_ip rows to manually specify an IP, subnet, and gateway
If your device already has a different IP address, also uncomment the use_address row. This IP will be used to upload the firmware, then the device should boot with the manual_ip specified.
Build image:
In a terminal open the folder where you have downloaded https://github.com/growboxguy/Gbox420/tree/master/ESPHome and run the following command:
esphome compile gate.yaml
The first time uploading you need to:
Connect the Pico W to the PC while holding the Boot Select Button and verify it shows up as a storage device
Locate the freshly compiled firmware.uf2 image under the config\esphome\build\.pioenvs folder
Upload firmware.uf2 to the Pico W storage device
Once the esphome firmware is running, you can upload the latest compiled firmware using:
esphome upload gate.yaml
You can verify the ESPHome firmware by accessing the logs generated by the Pico W by running the following command:
esphome logs gate.yaml
To compile, upload, and open the logs using a single command:
esphome run gate.yaml