link an ESP chip with Home Assistant (esphome 4)

main topic shortcuts > intro 1 > intro 2 > step 1 > step 2 > step3a > step 3b > step 4

When a ESP32 device has been flashed and powered, it will use the password you added to the code to connect to your wifi. The ESPhome interface in Home Assistant (pic below) will show that the device (or ‘node’) is Online. If you choose Show Logs you’ll see what it’s sending. On this page we get this data sent to Home Assistant.

Notice how this data log relates to the code used for flashing the chip (step 3). This ‘ticker tape’ of text, which appears in ESPhome, will be helpful when things appear awry.

Power for your device

Let’s pause to think about power supplies for different boards. A Sonoff device is self powered so fortunately it looks after itself. An ESP32 with a USB socket can be powered with an old phone charger ( 5v, 250mA). A ESP32-CAM may only have a 5v pin and a GND pin – so you’ll want to connect these pins to a USB charger. You could hack and solder an old USB cable as below, to power the ESP32-CAM. You could also use an FTDI, set at 5v as below, to power the ESP32-CAM.

Some projects use sensors connected to the ESP and they need power too. As I’ll show in other projects, I solder Dupont wires together to give a spare red and black wire for a sensor. The ESP32 pin marked VIN seems to have 5v and I’ve used that to power a sensor – but I can’t yet verify if that was a good or bad idea.

A way to power a ESP32-CAM board
Another way to power a ESP32-CAM board – the FTDI connects to a USB supply. The TX & RX wires can be omitted. (It’s a temporary fix because I want to use the FTDI to flash my next ESP32 chip)

Add the flashed ESP to Home Assistant

In Home Assistant click as follows: Configuration > Setup integrations > ESPhome > Enter the IP address > done.

Add the entities to the Home Assistant frontend

In step 7 above you saw the list of entities that were added to Home Assistant. The names correspond with the code you used and need remembering. Go now to the Home Assistant overview, click Configure UI > click + and choose a display card. For the full story of how this works, see the video or this tutorial, with more thanks to Juan.

Leave a Reply

Your email address will not be published. Required fields are marked *