I have about 15 ESP8266 and ESP32s all connected to HA. I needed another so I took an ESP8266 from its plastic bag and went to ESPHome web to do the Prepare for First Use and to provision WiFi. It fails every time at the WiFi stage. So I took another 2 x ESP8266s and tried again with the same result. So then I tried with ESP32s (two of them). Again with the fail ate the WiFi stage.
Then I tried installng WLED on the same devices. WLED has a similar web based initial FIrst Use installation. All 5 devices work 1st time on WiFi. I repeated this again with ESPHome web and once more, they all failed.
I then changed cables (micro USB and Type C) and then I changed PCs. All fail with ESPHome and All work with WLED. I used ESPTool to factory reset all of them.
This is not a Home Assistant issue. I have never got to the yaml stage. I have shut down Pi-Hole and reset my DNS to 192.168.1.1. My router is a Ubiquiti ERX and I have 3 x UniFi APs. The WiFi signal is good and strong.
Is this a known problem with ESPHome? I have never seen it before. I never get to add the device to HA so I do not have a yaml file to post.
I think I have read 20 posts on similar issues and nobody seems the have resolution. I have to be doing something wrong. What?
It’s not at all clear what you’re actually doing here.
Your esp8266 new from the box have ‘something’ preflashed (not esphome, nor would you know the OTA passwords, etc.), so your first flashing needs to be done over (USB2)serial. In the best case esphome can do that itself, if you connect it directly to the home assistant host, with chrome based browsers you might get away with connecting it to the client running your browser as well - or you do it all by hand via esptool (and to just download the resulting image). In either case you get the choice what to do while defining your new esp.
It’s your job to do the initial ‘initialization’ (including the wireless credentials via secrets).
A new esp8266 fresh out of the box is either blank or has some kind of random (blink-) sketch installed, you need to do the first flash yourself (but esphome builder does provide some magiv via USB).
My goal here is to add a single ESP8266 to HA. Nothing more.
All three ESP8266s and two ESP32s are brand new out of the box, clear?
I used ESPHome web to initialize them, clear?
All 5 devices went throught the, “Prepare for First use” stage of ESPHome web setup perfectly.
None of the 5 devices would connect to my WiFi.
So far, so good, I hope.
As a further test I then tried initializing them on WLED which also uses a web based initialization process. WLED’s process is similar to that of ESPHome except (obviously) the resulant flash content is different. Doing this, all five devices flashed WLED perfectly and connected to WiFi.
I factory reset all five devices using ESPTool and tried once more to initialize just one with ESPHome web. Once more nione of them would connect to WiFi.
To restate my issue, I cannot make ESPHome web connect any of my new ootb devices to WiFi. I am looking for help in doing so please.
That which has previosly worked flawlessly is no longer doing so.
I would if I could. I have no yaml code. I never get that far. I cannot even get wiFi connectivity of the ESP8266 r ESP32s. Without WiFi HA cannot adopt the device. As I said earlier, this is not an HA issue. I believe that either there is a issue with all of my new (out of the box) ESPs or, I am doing something wrong. I wish I could tell you more.
When I get a new ESP, it usually doesn’t have anything pre-installed that could connect to my Wi-Fi network.
So I create a new device in ESPHome and enter my Wi-Fi credentials there. Then I create a “Manual Download” version and flash it to the ESP using a USB cable and the ESPHome Flasher.
After that, I disconnect the cable, and after the restart, the ESP is accessible via Wi-Fi.
Minimum YAML Code:
esphome:
name: myproject
friendly_name: Test
esp8266:
board: d1_mini
# Activates logger support
logger:
api:
encryption:
key: "YOUR_KEY"
ota:
- platform: esphome
password: "YOUR_OTA_PASSWORD"
wifi:
ssid: "YOUR_NETWORK_NAME"
password: "YOUR_NETWORK_PASSWORD"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "YOUR_FALLBACK_NAME"
password: "YOUR_FALLBACK_PASSWORD"
# After 1 minute of unsuccessful WiFi connection attempts, the ESP will start a WiFi hotspot (with the credentials ap: from your configuration)
captive_portal:
…I think there’s an easier way using the web installer, but since I don’t usually use it, I can’t describe it.
You are correct Wally. However PuTTY needs either a working serial port (which I tried and got nothing back and any serial port speed) or an IP address which is currently not avaiable even though I know the addrss from my experiment with WLED.
I shall wait until tomorrow when the next batch of ESP32s arrive and try again.
You need to connect the USB cable to your ESPHome device again and use that connection as a serial connection in Putty.
I think the speed is usually set to 115200 baud
Yes, 115Kbaud is what it is. I have used it before. This time however, nobody was home. I may give this a shot now that I have it all working just to see what parameters it needs. Thanks for you help - all of you.
Just in case it is a router DHCP capacity issue, have you tried turning off some of your existing WiFi devices to see what happens?
The serial port log WiFi connection return codes may prove interesting.
Check for simple problems like spelling mistakes in passwords etc.
Thanks for the tip. I have well over 100 clients on my LAN. They are a mix of wired, fixed IP addresses and a pool of dynamic IPs. These are all managed by the Ubiquiti ERX router’s DCHP. It gives excellent reporting of both fixed and dynamic IPs. I have shut down about half the network (cut the power) to see if that helped. Nothing changed. I swore at the password and re-typed it several times and then cussed it some more so I am pretty sure I got it right. It was a copy/paste anyway.
Now I have the one ESP32 I wanted working. I also have 3 more arrivng from Amazon today so I can try again over the weekend. I’ll just keep banging at it until it does what I want.
Ubiquiti ERX. It is only a router. No WiFi. WiFi is handled by UNifi WiFi of which I have three. These are PoE. I used them when I was an IT manager and it just made sense to use them at home too,
You can sometimes find them on eBay. I hope this helps.
Chicken or egg? Just to clarify my understanding of your setup:
When the ESP powers up and reaches out to connect, it does via WiFi. The WiFi connection is to an UniFi (one of three), which consults with the Ubiquiti DHCP to allocate the ESP an IP Address as part of the connection process.
Wondering if you change the logger to be at the debug level (add it after line 9), recompile, and post the entire compile and subsequent connection log from ESPHome here may offer return codes and clues where it is coming undone. Please do not redact the IP Address from your LAN, as this offers a critical clue.
Do each of your UniFi’s have different SSID’s? Which one is defined in the secrets file?