ESPhome add new device stuck at initializing popup

While trying to add a new device to ESPhome the pop up menu with the progress circle spinning says initializing but stays there forever. I’ve tried rebooting and older backups. Not sure what else to do.

Are you using HA? if you are then when you first pug a ESPHome device in is best to plug it into the device running HA. Then when adding use the option that says something like “Connected directly to device running HA”

looks like it looking for it and can’t find it.

once you done your first set up you can then unplug it and do Over the air updates.

Hi Blacky, Not sure what you mean by running HA? In home assistant add ESPhome device list doesnt seem to have any other options other then “NEW DEVICE” button. Just sits and spins after clicking that button.

I have exactly the same problem…
Stays on “initializing” and impossible to add any new device… it starts yesterday
I had the possibility to install the update 2021.12.1, i did it, and now i have an error 502 bad gateway…

See ESPHome is Giving a 502: bad gateway error

Hmmm thats a problem (spinning wheel)

HA = Home Assistant

So you have HA okay

When you click on “New Device” a pop up window should show up
1
add your new device name and next
2
select our device option - next
3
you now add it to ESPHome next step is you need to connect to it - click install
4
Now you can see the option I was talking about - “Plug into the computer running ESPhome Dashboard”.

So the first time you set up a new device it is always good to have it plugged into the device running HA. I found it just works better. Once you done that you can disconnect it form the device and plug it in anywhere your network reaches and then you can do over the air updates.

Okay back to your spinning wheel. Something is wrong with your ESPHome it should show up instantly.

Lets try a few things in order.
1/ Is it possible to upgrade ESP home? If so try that.
2/ Is it possible to go to a backup that esphome did on a previous update? check you backups and esphome will be in the title, run that backup and upgrade esphome again.
3/ Remove esphome and reinstall it from the add-on store.

If one of these things work then follow the steps above :grinning:

PS: If your scared that something may break then maybe wait until ESPHome updates again and see what happens after that update.

Is it possible to go to a backup that esphome did on a previous update? check you backups and esphome will be in the title, run that backup and upgrade esphome again.

Guys please, there is any issue with the current version of ESPHome 2021.12.2. Check my link above.

Hey, just a heads up - I had this same problem and had already downgraded to 12.1.

Looking through the logs, it seems like the issue was that the WIFI information in secrets.yaml had gotten duplicated and it threw everything into a tailspin. See the log info below.

2021-12-21 11:18:58,359 INFO Running command 'esphome --dashboard -q vscode --ace /config/esphome'
2021-12-21 11:18:59,491 INFO 200 GET /static/js/esphome/c.15a3b839.js (0.0.0.0) 3.47ms
2021-12-21 11:18:59,516 INFO 200 GET /static/js/esphome/c.644ce6a3.js (0.0.0.0) 3.70ms
2021-12-21 11:18:59,529 INFO 200 GET /static/js/esphome/c.aab6931a.js (0.0.0.0) 4.42ms
2021-12-21 11:18:59,536 INFO 200 GET /static/js/esphome/c.2543b431.js (0.0.0.0) 3.14ms
2021-12-21 11:18:59,542 INFO 200 GET /static/js/esphome/c.56258c5a.js (0.0.0.0) 4.15ms
2021-12-21 11:18:59,549 INFO 200 GET /static/js/esphome/c.423f4a55.js (0.0.0.0) 3.37ms
2021-12-21 11:18:59,581 ERROR Uncaught exception GET /secret_keys (0.0.0.0)
HTTPServerRequest(protocol='http', host='homeassistant.local:8123', method='GET', uri='/secret_keys', version='HTTP/1.1', remote_ip='0.0.0.0')
Traceback (most recent call last):
  File "/esphome/esphome/yaml_util.py", line 344, in _load_yaml_internal
    return loader.get_single_data() or OrderedDict()
  File "/usr/local/lib/python3.9/dist-packages/yaml/constructor.py", line 51, in get_single_data
    return self.construct_document(node)
  File "/usr/local/lib/python3.9/dist-packages/yaml/constructor.py", line 55, in construct_document
    data = self.construct_object(node)
  File "/usr/local/lib/python3.9/dist-packages/yaml/constructor.py", line 100, in construct_object
    data = constructor(self, node)
  File "/esphome/esphome/yaml_util.py", line 75, in wrapped
    res = fn(loader, node)
  File "/esphome/esphome/yaml_util.py", line 161, in construct_yaml_map
    raise yaml.constructor.ConstructorError(
yaml.constructor.ConstructorError: Duplicate key "wifi_ssid"
  in "/config/esphome/secrets.yaml", line 6, column 1:
    wifi_ssid: "MY_SSID_NAME"
    ^
NOTE: Previous declaration here:
  in "/config/esphome/secrets.yaml", line 2, column 1:
    wifi_ssid: "MY_SSID_NAME"
    ^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/tornado/web.py", line 1702, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "/esphome/esphome/dashboard/dashboard.py", line 135, in decorator
    return func(self, *args, **kwargs)
  File "/esphome/esphome/dashboard/dashboard.py", line 855, in get
    secret_keys = list(yaml_util.load_yaml(filename, clear_secrets=False))
  File "/esphome/esphome/yaml_util.py", line 336, in load_yaml
    return _load_yaml_internal(fname)
  File "/esphome/esphome/yaml_util.py", line 346, in _load_yaml_internal
    raise EsphomeError(exc) from exc
esphome.core.EsphomeError: Duplicate key "wifi_ssid"
  in "/config/esphome/secrets.yaml", line 6, column 1:
    wifi_ssid: "MY_SSID_NAME"
    ^
NOTE: Previous declaration here:
  in "/config/esphome/secrets.yaml", line 2, column 1:
    wifi_ssid: "MY_SSID_NAME"
    ^
2021-12-21 11:18:59,596 ERROR 500 GET /secret_keys (0.0.0.0) 19.47ms
2021-12-21 11:19:03,314 INFO 304 GET /devices (0.0.0.0) 2.06ms
2021-12-21 11:19:08,325 INFO 304 GET /devices (0.0.0.0) 2.59ms
2021-12-21 11:19:13,327 INFO 304 GET /devices (0.0.0.0) 2.06ms
2021-12-21 11:19:18,334 INFO 304 GET /devices (0.0.0.0) 2.49ms

Once i got in there and deleted the redundant information, the spinning wheel went away.

9 Likes

Second that mrmees, That worked

In ESPhome dashboard edit SECRETS button. I found a extra entry. deleted that. and presto.

Not sure why there is another secrets.yaml in my file editor config directory that did not match the esphome one. But it was clean of duplicates.

7 Likes

Nice!!! Glad you fixed it :grinning:

My issue was similar but this helped me figure it out. I had a secrets.yaml that had my wifi info but also a common/wifi.yaml with my wifi info. once I deleted one instance of the wifi info, I was able to flash a new device normally.

Old info still has value !!!
You’ve sold my problem, thanks!!!