- Install Home Assistant as container
docker compose up -d
If you need Docker run for Raspbian/Debian/Ubuntu distros:
sudo bash utils/install-docker.sh
-
Run the steps for ESPHome installation, when completed run step 3
-
Install the ESPHome integration and in the "host" field, put your esp8266 ip address
- Install Python on your PC, you can install a specific version by running:
sudo bash utils/install-python.sh 3.11.0
- Install pip and venv
sudo apt-get install python3-pip python3-venv -y
- Clone repository and activate virtual environment
mkdir -p env
python -m venv env/
- Install ESPHome and other requirements
python -m pip -r requirements.txt
-
Connect esp8266 to your PC using USB cable (buy esp8266 with serial converter integrated)
-
Edit esphome-configuration/secrets.yaml to reflect your current wifi network
-
Move esphome-configuration/secrets.yaml and esphome-configuration/sht20.h (only if you use it, otherwise it's not required) to .esphome directory
mv esphome-configuration/secrets.yaml esphome-configuration/sht20.h .esphome
- The first time you flash esp8266, you need to tell esphome some information about your esp8266 device. Right after that, it will validate the configuration, create a binary, upload it, and start logs
cd .esphome && esphome wizard esphome-config.yaml
Next time you'll flash it, you just need to run:
esphome run esphome-configuration/esphome-config.yaml
- Take note of the ip address printed out in the logs after you run previous command Read all the output and check for sensors errors, if clear come back to Home Assistant installation steps
BME280 Temperature + Humidity + Pressure (i2c bus)
SENSOR | ESP8266 |
---|---|
VIN | 3V3 |
GND | GND |
SCK | SCL |
SDD | SDA |
SHT20 Temperature + Humidity (i2c bus)
SENSOR | ESP8266 |
---|---|
RED | 3V3 |
BLACK | GND |
GREEN | SDA |
YELLOW | SCL |
MH-Z19C NDIR (uart bus - 7pin terminal connection version)
SENSOR | ESP8266 |
---|---|
PIN4 VIN | 5V |
PIN3 GND | GND |
PIN5 RX | TX |
PIN6 TX | RX |
Denkovi USB 8CH relay board
DEVICE | RPI4 |
---|---|
USB-B | USB |
Home Assistant configuration.yaml
contains configuration for controlling USB relay board,
using RESTful Binary Sensor.
To get it working, an API service must be started within raspbian OS.
Here's the repo: usbAPI
In this case, the relay board is controlled by a jar file but it can be adapted to any other board by editing the commands to run.
DEVICE | REQUIRED POWER SOURCES |
---|---|
Denkovi USB 8CH relay board | 12V 1A + 220V |
Esp8266 | 5V 2A |
Raspberry Pi 4 | 5V 2A |
Raspberry Pi 4 Fan | 9V 1A |
Power sockets | 220V 16A (1,5mm2 cables) |
Take a look at 3D directory, references:
- Raspberry Pi 4 case (40mm fan) by John_Sinclair on Thingiverse
- 12V USB 8 Channel relay board by polysquare on Thingverse
- BME280 case by leptitnicolas on Thingverse
- Arduino nano + 2 channel arduino relay + voltage stepdown box by flying_ginger on Thingverse. Used for housing ESP8266 (by making a drawer/slot manually since screw holes aren't available on the board), MH-Z19, cables and as attach surface for placing BME280 externally.