I have just successfully flashed a new ESP8266 device with ESPHome. It automatically took the name esphome-web-78cd84.
After successfully loading the initial firmware, I disconnected it from power, disconnected the wire that grounds GPIO00 (flash mode) and reconnected the power so that it reboots in normal mode.
It shows up on the ESP dashboard and I can ADOPT it.
It then has status ONLINE in black with no border colour – I expect a green border and the word ONLINE in green.
If I now try to do an update OTA, e.g. to add switches to the configuration, it fails after successful compilation with the message
INFO Resolving IP address of esphome-web-78cd84.local
ERROR Error resolving IP address of esphome-web-78cd84.local. Is it connected to WiFi?
ERROR (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
ERROR Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -2] Name or service not known
I then tried making the change to static IP address and downloaded it over the wired connection, but it still failed to connect to the device saying ‘no path to host’.
If I scan with an IP scanner app, there is no sign of it.
Am still struggling with this after many repetitions, a whole day or trial and error…
I should have mentioned that at the end of the flashing process I get the error pop-up in ESPHome Web
An error occurred. Improv Wi-Fi Serial not detected
On the internet (various forums) some say it has to do with when you release the GPIO0 to ground connection on the ESP8266, which is necessary to get it to connect for firmware load in the first place. I tried disconnecting at various times, and powering the board off and on again before or after the GPIO0 release. Nothing I tried made any difference.
Others say that it only works if you flash with it connected to the machine that is hosting ESPHome. I don’t know why but tried it anyway. Getting the USB port to connect to the ESPHome container is fiddy because it requires all sorts of mapping and permissions (a whole other story). I did get it going and flashed the chip, but in the end this made no difference either: it will still not connect to WiFi after flashing.
I feel I am very much shooting in the dark. Can someone explain, or point to documentation that explains, exactly how the WiFi is set up on the ESP device and connects after flashing so that it can be seen by the ESP Home dashboard?
Can I ask why use two vs the same SSID except for different VLANs?
I don’t claim to know the best setup, but currently my setup has one SSID for main and one for IOT. Both access points broadcast both and devices roam between them unless I’ve locked a fixed device to a specific AP.
Thanks everyone for the input. After a lot of trial and error, I got it working.
Some observations:
It is perfectly fine, and I advise it, to operate the ESPHome container remotely from another computer (in my case an iMac) using the web interface.
It is perfectly fine to make the initial config using this remote computer. There is no need to resort to the command line approach. It works OK but is tedious and error-prone. The file created is correctly stored on the Linux directory as I specified it at container setup (/opt/esphome/config)
It is perfectly fine to flash the ESP8266 for the first time from this remote computer – it does not (as rumoured) have to be the one hosting ESPHome.
It is not easy to connect a browser securely to ESPHome in a Docker container, but there is no real need. Using ESPHome Web to download the bin and then load it manually works fine.
So, in case anyone else has the same problem, this is what worked for me:
After setting up the ESPHome and Home Assistant containers, connect to them from a convenient machine and a convenient browser. Do not worry about secure connection or using a browser with a web serial capability.
In the ESPHome dashboard, create a new device. Name it and keep a copy of the encryption key when it is offered. This saves the initial <your-device-name>.yaml file, which you can confirm using the terminal (on the host or by SSH). At this point I do not advise adding anything to the basic config file, in case you lose it.
From the ESPHome dashboard device click ‘Install’ and take the option to go to the ESPHome Web page.
Connect the device to be flashed e.g. in my case via an FTDI board. Set the receiving device in flash mode (for an ESP8266 ground GPIO0).
DO NOT select ‘Pepare for first time use’ but instead simply Install.
Take the option to download the project and load it manually. Note that after ‘preparing for download’ finishes, it is not downloaded. You have to press the link, then accept the .bin file into your downloads folder. In my case (on Chrome) I had to click a ‘keep’ option to confirm security before it actually saved it.
Now go to flashing step 2: select the download file and proceed with the flash.
After flashing, disconnect power from the board, disconnect the flash mode (grounded GPIO0) and reconnect power, so the board reboots in normal mode. Just disconnecting the flash mode is not enough.
To test it, go back to the ESPHome dashboard, where the device should now show as CONNECTED. Do not worry that the black-and-white appearance on the container version looks different from the HA add-on version (which says ONLINE in green). Try installing the same file again, but this time do it over the wireless connection, to prove it works.
Now go to Home Assistant. The new device should be there and asks you to configure it. You will need the encryption key you saved earlier.
In Home assistant you should now see the device with no entities. Note that if you make mistakes in the configuration later, or you get strange error messages, it is OK just to delete the device from HA. It will pop up a few seconds later as a discovered device and you can add it again. However, DO NOT delete the device from the ESPHome dashboard. If you do that, you will have to start again.
NOW is the time to start adding to your configuration the definitions of the devices connected to your ESP processor. Add one or two at a time. Each time Install using the wireless method. The attached devices should appear as entities in Home Assistant. If you have to delete or change any, HA does not purge them, but deleting the device in HA (not ESPHome) and re-adding it tidies it up.