ESPhome config for my ESP32 boards
The ESP32C3 boards used with this repository are:
- Ball valve controller
- Heat pump control board with serial port and/or IR blaster interface
- 4-way water valve controller
- 3x relay board used for garage doors or small motor speed control
... but this should also work with similar boards
To use this ESPHome setupo, you will need:
- A
bash
shell environment or similar (Linux, MacOS, WSL does not really matter) - python 3.8 or later
python -V # assess your python version
mkdir -p ~/venv # any top level dir for virtual environments will do
python3 -m venv ~/venv/esphome # set up a new python venv for esphome
source ~/venv/esphome/bin/activate # activate this environment
pip install pip --upgrade # upgrade pip install first
pip install esptool # you may need esptool for uploads, resets etc of devices
pip install esphome # this will take some time ...
sudo apt install tio # optionally install tio or serial console IO from ESP devices
cd && cd git # go to where you use your local git repositories
git clone https://github.com/hansrune/esphome-config.git # either clone this repo for initial download
cd esphome-config/
git pull # ... or update existing clone
git status # verify that you are on the expected branch
The secrets.yaml is kept outside the git repository. I prefer to set that up as follows:
touch ../secrets.yaml # create secrets file outside of the repository
ln -s ../secrets.yaml . # link that in here
grep '!secret' *.yaml */*.yaml # list the secrets you want to define
... then edit secrets.yaml
with your favourite editor
Other options you may want to change:
common/communication.yaml
- you may want to use Home Assistane api over mqtt.common/time.yaml
- change time_timezone to your timezone
Copy test*.yaml
templates to more meaningful filenames for your ESPHome devices. Then change the subtitutions section at the top to your preferences
You can build the firmware like this. Before the initial upload, you will want to connect your ESP device to a local serial port. Later uploads can be over the air (OTA)
esphome compile your_device.yaml
esphome upload your_device.yaml
You should check that the code loads from using a serial console. For example
tio /dev/ttyACM0
(use Ctrl+t q to quit)