Esp32 board not connecting

I am trying to connect up an esp32 devkit v4 to home assistant via ESPhome, but when I restart the esp32 the red bar in Home Assistant stays red (does not go green) - i.e. it does not connect.

the closest match I can find in the list of supported boards is the following: PlatformIO Registry
is a
DOIT ESP DEVKIT V1

(When I use that board type in the Arduino IDE to build a non-Home Assistant project it works).

Here is my yaml file:

esphome:
name: esphome-garage-door
platform: ESP32
board: esp32doit-devkit-v1

#esp32:
#board: esp32doit-devkit-v1
#framework:
#type: arduino

#Enable logging
logger:

#Enable Home Assistant API
api:
encryption:
key: “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=”

ota:
password: “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password

#Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: “Esphome-Garage-Door”
password: “xxxxxxxxxxxx”

captive_portal:

and here are the results of the log following the install and a reset of the ESP32 board:

ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124
load:0x40080400,len:5828
entry 0x400806a8
[I][logger:243]: Log initialized
[C][ota:461]: There have been 0 suspected unsuccessful boot attempts.
[D][esp32.preferences:113]: Saving 1 preferences to flash…
[D][esp32.preferences:142]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[I][app:029]: Running through setup()…
[C][wifi:037]: Setting up WiFi…
[D][wifi:373]: Starting scan…
[D][wifi:388]: Found networks:
[I][wifi:432]: - ‘xxxxxx’ [redacted]▂▄▆█
[D][wifi:433]: Channel: 3
[D][wifi:434]: RSSI: -33 dB
[I][wifi:432]: - ‘xxxxxx’ [redacted]▂▄▆█
[D][wifi:433]: Channel: 3
[D][wifi:434]: RSSI: -64 dB
[I][wifi:432]: - ‘xxxxxx’ [redacted]▂▄▆█
[D][wifi:433]: Channel: 3
[D][wifi:434]: RSSI: -64 dB
[D][wifi:437]: - [redacted] [redacted]▂▄▆█
[D][wifi:437]: - [redacted] [redacted]▂▄▆█
[D][wifi:437]: - [redacted] [redacted]▂▄▆█
[D][wifi:437]: - [redacted] [redacted]▂▄▆█
[D][wifi:437]: - [redacted] [redacted]▂▄▆█
[D][wifi:437]: - [redacted] [redacted]▂▄▆█
[D][wifi:437]: - [redacted] [redacted]▂▄▆█
[D][wifi:437]: - [redacted] [redacted]▂▄▆█
[D][wifi:437]: - [redacted] [redacted]▂▄▆█
[D][wifi:437]: - [redacted] [redacted]▂▄▆█
[D][wifi:437]: - [redacted] [redacted]▂▄▆█
[D][wifi:437]: - [redacted] [redacted]▂▄▆█
[D][wifi:437]: - [redacted] [redacted]▂▄▆█
[D][wifi:437]: - [redacted] [redacted]▂▄▆█
[I][wifi:248]: WiFi Connecting to ‘xxxxxx’…
[I][wifi:505]: WiFi Connected!
[C][wifi:353]: Local MAC: xx:xx:xx:xx:xx:xx
[C][wifi:354]: SSID: [redacted]
[C][wifi:355]: IP Address: 192.168.xxx.xxx
[C][wifi:357]: BSSID: [redacted]
[C][wifi:358]: Hostname: ‘esphome-garage-door’
[C][wifi:360]: Signal strength: -31 dB ▂▄▆█
[C][wifi:364]: Channel: 3
[C][wifi:365]: Subnet: 255.255.255.0
[C][wifi:366]: Gateway: 192.168.xxx.x
[C][wifi:367]: DNS1: 192.168.xxx.x
[C][wifi:368]: DNS2: 0.0.0.0
[D][wifi:514]: Disabling AP…
[C][ota:085]: Over-The-Air Updates:
[C][ota:086]: Address: esphome-garage-door.local:3232
[C][ota:089]: Using Password.
[C][api:025]: Setting up Home Assistant API server…
[I][app:062]: setup() finished successfully!
[I][app:102]: ESPHome version 2022.8.3 compiled on Sep 11 2022, 15:18:49
[C][wifi:491]: WiFi:
[C][wifi:353]: Local MAC: xx:xx:xx:xx:xx:xx
[C][wifi:354]: SSID: [redacted]
[C][wifi:355]: IP Address: 192.168.xxx.xx1
[C][wifi:357]: BSSID: [redacted]
[C][wifi:358]: Hostname: ‘esphome-garage-door’
[C][wifi:360]: Signal strength: -32 dB ▂▄▆█
[C][wifi:364]: Channel: 3
[C][wifi:365]: Subnet: 255.255.255.0
[C][wifi:366]: Gateway: 192.168.xxx.x
[C][wifi:367]: DNS1: 192.168.xxx.x
[C][wifi:368]: DNS2: 0.0.0.0
[C][logger:275]: Logger:
[C][logger:276]: Level: DEBUG
[C][logger:277]: Log Baud Rate: 115200
[C][logger:278]: Hardware UART: UART0
[C][captive_portal:088]: Captive Portal:
[C][mdns:094]: mDNS:
[C][mdns:095]: Hostname: esphome-garage-door
[C][ota:085]: Over-The-Air Updates:
[C][ota:086]: Address: esphome-garage-door.local:3232
[C][ota:089]: Using Password.
[C][api:138]: API Server:
[C][api:139]: Address: esphome-garage-door.local:6053
[C][api:141]: Using noise encryption: YES

The signal strength for the network I am connecting to seems good and there are no errors that I can see in the log that indicate what the problem might be.

I have double-checked the firewall rules and the IP addresses of the Home Assistant box (Raspberry PI) and the ESP32 board have access to each other.

I also tried changing the board to
esp32dev
but still no love.

Also, once the ESP32 restarts although it doesn’t connect to Home Assistant, I can successfully ping it from another computer.

Any guidance or support would be appreciated.

OK - I made some progress, but it was painful.

My home network is divided into two networks, let’s call them Network1 and Network2.

Network1 I use for all my IOT devices. Network2 I use for our family computers and cell phones.

When I originally set this up I pointed the new esphome connection for my esp32 to Network1.

Once done, while I could ping my esp32 running esphome from Network2. However, I could not get ESPHome to show it as connected.

I then decided to change my secret ssid and password so the esp32 would be defined on Network 2 instead of Network 1. I installed it, and restarted the ESP32. It still did not connect.

However, after looking at the log I realized the ESP32 was still trying to connect to Network 1 - even though the secret file was pointing to Network 2.

I tried installing it again (several times) but it kept pointing to Network 1.

I tried the ‘Clean Build Files’ - it still didn’t work - continued to point to Network 1.

I also tried hardcoding the SSID and Password for Network 2 in my config file, reinstalling it, restarting the esp32, but the log file continued to show it trying to connect to Network 1.

I eventually deleted my ESP32HOME app and the ESPHOME service completely from Home Assistant and restarted the Home Assistant itself.

After that, I reinstalled ESPHOME and tried to set up my app again. To my surprise, I did not have to re-enter my Secret SSID and Password as it was retained even though I had deleted the prior esp32app and ESPHOME from HomeAssistant.

Regardless, I installed the same app as before ( board esp32dev ) and it connected to Network 2. However, while the bar is no longer red, it is gray not green??

I would still prefer to have it working on Network 1. I found this post, ESPhome over VLAN - hostname resolving which may have something to do with it, but it is above my pay grade.

If anyone has any insights, I would be happy to hear them.

If you have mDNS working across your network esphome should work as expected (including the dashboard online indication).

The FAQ on esphome.io got you covered about this topic: Frequently Asked Questions — ESPHome

I think grey is the new green (someone with :green_apple: logic probably was in charge for that change…)

Important to know is that the api connection is initiated from HA to the esphome node (that acts as a server in that case) - many people only allow connections the other way around and that obviously can’t work.

Thanks, that was helpful - esp. knowing that gray is the new green.

One note: following up on my earlier difficulties, I have found that if when updating the esp32 device ( after the initial install) if I used an usb connection for the install then it did not work - even though it says it did. It would say erasing … 1% to 100% … completed successfully. However, when I looked in the log traces of the old setup were there. More specifically I originally had a temperature sensor added, but after I deleted it from the yaml and did the install via usb (which reported as successful) the temperature sensor was still referenced in the log. I did find however if I did an OTA update the updated worked as one might expect - and the reference to the temperature sensor was no longer there.

Regardless, what is now happening is I can see the sensor updated in the log from the ultrasonic sensor which I added in; however, I can’t see / link the sensor as an entity in the dashboard.

Here is the yaml

esphome:
name: esphome-garage-door

esp32:
board: esp32doit-devkit-v1
framework:
type: arduino

#Enable logging
logger:

#Enable Home Assistant API
api:
encryption:
key: “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=”

ota:
password: “6a3d58e4e3492c110b113a0be6341538”

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password

#Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: “Esphome-Garage-Door”
password: “xxxxxxxxxxxx”

captive_portal:

sensor:

  • platform: ultrasonic
    trigger_pin: 15
    echo_pin: 12
    name: “Ultrasonic Sensor”
    update_interval: 5s
    filters:
    • filter_out: nan

never mind I’ve figured out, or at least am figuring out, getting the dashboard updated.

Please, if you’re going to post your yaml, post it properly. How to help us help you - or How to ask a good question