Did I just loose years of HA development?

I have been using HA for many years and I have a very elaborate setup with 34 integrations, 22 ESPHome nodes and a few other odds and ends. An now I have messed it all up (sad).

It started with me wanting to align the naming of the ESPHome nodes, I added consistent friendly names and used the recently added rename function for the nodes. The result looked great on the ESPHome cards. Then I tried to figure out how HA was dealing with these name changes with respect to the entity ID’s. I still don’t get the logic, but after two days it seemed more or less cleaned up. I was also able to fix the dashboards, the automations and the scripts. BUT I could not not get the configuration files fixed, I just could not figure out what entity IDs had changed in what way. I could not even figure out what still worked and what did not. It seemed hopeless.

So I gave up and decided to restore a backup from a few days earlier before I started all this. That got me into more trouble. After the restore the majority of the ESPHome devices cannot be contacted anymore. I will have to dig them out from all over the house to reprogram them.

Not sure where I’m going with this. Maybe some-one has some good advice. Maybe it is just a warning to others.

I have no idea what I will do next. I just don’t feel like starting from scratch.

Not too much help for you, but this is why running a virtualised environment makes sense. You could have copied your HAOS into another VM, make the changes, test and if things break bring the old instance back live.

All this takes seconds to achieve, assuming HAOS changes do not change hardware settings.

1 Like

That sound good (for if I ever have the courage to start with HA again). But would that not have the same issue? The changes to the ESPHome nodes are not compatible with the earlier instance.

The restore would have to re-install the ESPHome nodes rather than just replace the .yaml files with incompatible ones.

Did you restore both core and esphome add-on?

I did a restore of a full backup. Running HA on a RPi with SSD. I guess that restores the ESPHome add-on?

All the ESPHome .yaml files changed (the the version of the backup date), that is causing the problem.

A few thoughts:

  • Step One - backup everything you have, then go for a walk outside. This step is CRITICAL both to success and health.
    Pulling all-nighters just creates crap code and crap problems (9600 8N1 greybeard speaking).
  • Step Two - next day, collect all of your backups and old SD cards in one place and…
  • HASS backups are just tar gzip files, of tar gzip files, so if you have several backups, you can take then apart and extract / restore parts.
  • If the HASS server is on the same IP (same hardware so likely), I thought you could adopt them even into a clean install?
1 Like

Solid advice! Specially step one. Thank you.

Updating or changing ESPHome in any way does not push information to the ESP devices. ESPHome manages your ESP devices, nothing more. You can completely run ESP devices without ESPHome existing on your network.

Why am I saying this? Because if you can’t connect to your ESP devices, it’s probably something on your devices themselves. HA will just access them over your network using a hostname or ip address.

If you set all your ESP devices to use MQTT, then you need to ensure that Mosquitto is running with the credentials you originally gave to your ESP devices.

1 Like

Do you see them in Developers Tools, States? Possibly with a “_2” suffix.

If you changed the esp name, updated the esp firmware and then put a backup back with old esp yaml files, then trying to update them over wifi won’t ‘find’ them because ESPHome, is trying to find them by their old name via mdns. But they are advertising their new name, not the old.

The backup will restore a lot, but not flashed firmware on an esp.

HA, even after backup, should be able to find them, though. With their new name. If you have the modified yaml files for the renamed esp’s you will be able to flash them again. If you change the name in the old yaml you should also be able to flash them again too. And rename them back to the original. As long as you’ll be able to figure out what you renamed to what.

1 Like

YES!!

I’m just discovering that. I noticed that only the nodes that had the name changed did not connect. Changing the ESPHome .yaml filename to the new name makes them connect again (the new names are generic, I can find them back).

That is a big step forward. I do not need to do any digging.

I still do not know what is all broken due to the renaming. I will first have to understand the (re-)naming logic and implications, before I do anything else.

The renaming doesn’t affect anything but the names of the entities. All your entity_id’s remained the same. If you want to change the names displayed in the user interface, change the device name and or the entity name via the UI for the ESPHome integration, nothing else. Nothing in esphome, nothing on the physical device.

1 Like

… unless the friendly name was changed as well, which is prepended?

No, that’s not how it works. Once an entity is registered in the entity registry, it’s set for life and auto-generated names do not affect it. I’m 9999% sure i’ve already described this to you during the MQTT-name-gate 2023.

1 Like

I have been able to restore contact with all ESPHome nodes except for two.

I had to change the ESPHome .yaml file names and the “name:” in the .yaml files to the new node names (instead of the old names that where restored from the backup). The two I could not restore did not exist at the time of the back-up, so there is no .yaml file. I will have to hardwire those two to recreate, they are accessible, not a big deal.

So first learning; yes you can rename the ESPHome nodes, but then you cannot use an existing backup without going through the above for the renamed nodes. So, create a backup after renaming ESPHome nodes.

And … it is broken again.

I do not know when or how or why, but somehow the new “name:” for three of the ESPHome nodes got included in all related entity IDs and all existing references now fail.

Example:

original ID:
‘binary_sensor.plc_back_lights_on_off’

now changed to:
‘binary_sensor.sonoff_4ch_dc_01_plc_back_garden_lights_onoff’

The new ESPHome node name for the PLC Interface ‘sonoff_4ch_dc_01’ has been added to the ID.

That’s causing your problems. I was pretty clear above that you don’t make name changes in the esp devices.

I had to change the “name:” in the ESPHome .yaml file to be able to connect back to the nodes.

Only changing the .yaml filename showed the nodes online again, but I could not get logs and I could not install an updated .yaml. Only after also changing the “name:” in the .yaml file to be the same as the filename I could do that again.

No you didn’t. Esphome just uses the hostname. It does not care about the name in the file. Esphome is a glorified text editor that pushes configuration to devices.

If the hostname was changed and pushed by you in the past, that could be the problem. Just change the hostname back to what it was.

Where do I change the hostname?