Relink esphome devices after a complete reinstall

Hello everyone,

I’m in a strange situation with my esphome devices (mainly sonoff for now).

Some days ago I experienced a complete meltdown of the hass.io server (hosted on a virtual box ) , and considering that when I was able to restart it, it still was having big issues and because I’m still in early ‘development’ I decided to start over with a fresh install, and then copy the config files (well the ones I felt comfortable with) back into the hass.io config folders.

Now the problem…

I first tried to copy the esphome folder back into the config, the devices showed up in the esphome gui, but then there were all kinds of weird stuff going on, like configurations not accessible and devices offline even though they were not.

So I erased the config folder for esphome, just for the sake of it I reinstalled ESPhome, and then I tried recreating one ESPhome device with the same id as the old one, I pasted the config I had backed up, and here I’m stuck:

I can access, edit , compile and upload the binary to the device, I can see the log and everything seems good although the ESPhome gui says the device is always offline, and the device isn’t listed in Home assistant so I can’t use it

So, the big question is, how do I get these ‘orphaned’ devices back into the hass.io system ?

Claudio

In the past when I reinstalled from scratch I just reinstalled ESPHome plugin in hassio, copied through the Samba share of hassio the yaml file of my ESPHome nodes in the ESPHome directory and just recompile each one through the web interface and it should be fine ! Then just add back nodes in HA through the Integration web page and it should be ok :wink:

Thank you Vincen, :partying_face:

I didn’t realize that I needed to relink manually the devices from the integrations page, also because I recreated the device in esphome using the gui, anyway now I can see and control the esphome device (sonoff) from the hass.io interface.

Just to be sure, from now on, it should behave as before ? i.e. the esphome changes should be reflected in hass.io , I hope

Thank you again, saved me a lot of trouble.

Claudio

Yep the integration page in HA is completely independant of what you do in ESPHome part ! If you recreated devices in ESPHome using GUI, it’s same as copying yaml esphome files from your previous setup :wink: You might just need still to recreate the secret.yaml file if you were using that as you can’t create that file from ESPHome GUI :frowning:
Once done you can then relink each node with HA by adding them in Integration page and you are all done !

Yep exactly ! Enjoy :wink:

Ok, I didn’t use the secrets file.

Right now the device is showing in hass.io and I can control it.

I still have an issue, in the esphome gui the device is always reported offline, tomorrow I will try again and see how to solve that

Thank you

Claudio

Did you change IP adresses of your nodes ? Do they have fixed IP adress ? your router supports mdns resolution ?
I strongly advise to always use fixed IP adress for each node and setup integration using IP adress and not mdns names (so you don’t depend of an external point of failure !)

HI, the IP address is the same, and the device has fixed IP address, not sure about the router mdns support, as it the provider one (for now), but anyway it is the same as 2 days ago when it was working ok.

I will try to relink another Sonoff today or tomorrow and see if this issue is repeating

Thank you

Claudio

Ok, now I made some more tests and even though I found the solution, I think there is something wrong in the gui.

Anyway:

  • I created a new esphome device with the same id as the old one, and a problem arises, even if the yaml file is created (I checked it with the smb connection) when I click the edit button I just see a blank page with the message 404 not found, the only way out of this is to delete the device that I just created, the yaml file won’t be deleted, and reloading the esphome gui page, the device is still there , only it is now possible to read and edit the yaml file, to upload it and when it is set , the online state is correctly detected.

  • I assumed it was an install problem, so I tried to build a new hass.io machine ( a barebones one) , I tried the same thing and I had the same issue, i.e. editing not possible until the device is ‘deleted’ …

So like I said I found a solution , but I don’t know how to solve the new device issues.

TBD

Claudio