#All ESPHome selects have changed their entity_id on update
1 messages Β· Page 1 of 1 (latest)
entity ids that were previously in the entity registry should never change as the entity_id is always fetched by the unique id
The only way I could see that happening is that the unique id changed
thats very concerning as the integration can only suggest an entity_id, it should never be able to change an existing one
the entity_platform is responsible for restoring the previous entity_id based on looking up the unique id
yea, these have been changed as well
Ip addresses are only gathered, these are not shown anywahere, so I did not noticed that entity ID change
I've dug through the entity platform code, and can't find any potential restore issues there. I wouldn't expect any since we would have seen this before.
let me dig through the registry code.. may be there is a long standing bug there
probably it added only changed entities which were not used anywhere.
I have two select entities. one changed ID in the dashboard, the other one not and I needed to change it manually to the one with prepended device name
Can you show the created date?
it is not showing it, just modified
but the entity id has been changed after upgrade. so there is no history
registry definitely doesn't use suggested_object_id if the entity was already in the registry https://github.com/home-assistant/core/blob/4e8d68a2efca4e98019453ab5c5491a36f3ca222/homeassistant/helpers/entity_registry.py#L870
other entities without changed entity id have a history
although we do waste time working it out and throw it away https://github.com/home-assistant/core/pull/144079 .. fixes that .. but not your issue
As a double check, do we persist the calculated entity id or the actual entity id
we persist the actual entity id
Oh wait. Now that I'm writing it, it probably doesn't make sense
Given the indices
grep gate.mcu_gate_gate /config/.storage/core.entity_registry. (edit: fix to be .storage)
what does that show?
https://pastebin.com/ZxFjUx21 (just ignore these from mcu-gateway)
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
can you do mcu_gate instead of mcu-gate ?
copy/paste doesnt work... grr
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
β ~ grep select.mcu_gate /config/.storage/core.entity_registry
{"aliases":[],"area_id":null,"categories":{},"capabilities":{"options":["Open","Closed","Opening","Closing"]},"config_entry_id":"b641feff25b89504b2d3b9eea65a00f8","config_subentry_id":null,"created_at":"1970-01-01T00:00:00+00:00","device_class":null,"device_id":"27377805d4a10b69213d1d3556453bd7","disabled_by":null,"entity_category":null,"entity_id":"select.mcu_gate_gate","hidden_by":null,"icon":null,"id":"72aa006c0b1754ba4fb4f2f426dca648","has_entity_name":true,"labels":[],"modified_at":"2025-04-30T21:41:15.258764+00:00","name":null,"options":{"cloud.google_assistant":{"should_expose":false},"conversation":{"should_expose":false}},"original_device_class":null,"original_icon":null,"original_name":"Gate","platform":"esphome","supported_features":0,"translation_key":null,"unique_id":"94:B9:7E:8D:97:E0-select-gate","previous_unique_id":null,"unit_of_measurement":null},
downloading backup (16 GB) will compare it before upgrade
downloading from HA is crashing. hm
{"aliases":[],"area_id":null,"categories":{},"capabilities":{"options":["Open","Closed","Opening","Closing"]},"config_entry_id":"b641feff25b89504b2d3b9eea65a00f8","config_subentry_id":null,"created_at":"1970-01-01T00:00:00+00:00","device_class":null,"device_id":"27377805d4a10b69213d1d3556453bd7","disabled_by":null,"entity_category":null,"entity_id":"select.mcu_gate_gate","hidden_by":null,"icon":null,"id":"72aa006c0b1754ba4fb4f2f426dca648","has_entity_name":true,"labels":[],"modified_at":"2025-04-30T21:41:15.258764+00:00","name":null,"options":{"cloud.google_assistant":{"should_expose":false},"conversation":{"should_expose":false}},"original_device_class":null,"original_icon":null,"original_name":"Gate","platform":"esphome","supported_features":0,"translation_key":null,"unique_id":"94:B9:7E:8D:97:E0-select-gate","previous_unique_id":null,"unit_of_measurement":null},
"94:B9:7E:8D:97:E0-select-gate"
thats the unique id
so whatever was in the registry before the update for that unique id should have been preserved
# <mac>-<entity type>-<object_id> return f"{formatted_mac}-{_TYPE_TO_NAME[type(entity_info)]}-{entity_info.object_id}"
thats what ESPHome uses to define the unique id
and what about entity id? so the new behavior is if there is no friendly_name just to use device name instead?
"created_at":"1970-01-01T00:00:00+00:00" means the entity registry entry was created before v1.15 of the entity registry where created_at was added so its set to 0 which implies that the registry entry has been there for a while, so the entity_id should not have changed.
If there is no friendly name set, it falls back to the device name
but this is new. because it was using just entity name: defined in esphome.
yes thats what https://github.com/home-assistant/core/pull/143049 does, by always setting has_entity_name = True
the whole prepending device name and Camel-Case is driving me insane π
people who have ugly device names (all my esphome devices have that mcu- prefix) is this not good way. sure, I could add friendly_name, but this would need to basically change all names in config and then rename everything in HA
Yeah, I hear you. Unfortunately, that ship kind of sailed in 2023 β Home Assistant fully switched over to the new entity naming format.
https://developers.home-assistant.io/blog/2023/06/28/entity-name-changes
Since then, all new integrations have to use has_entity_name=True:
https://developers.home-assistant.io/docs/core/entity#has_entity_name-true-mandatory-for-new-integrations
And it's part of the integration quality checklist now too:
https://developers.home-assistant.io/docs/core/integration-quality-scale/checklist
Definitely a change, but itβs the direction everythingβs moving in now.
for example. In the basement I have multiple devices driving lights and sockets. All have prefixed name Basement. So I really cannot use friendly_name
then when one device is for multiple purposes - so a "Sewage Treatment Blower" has no Basement on front as it doesn't make sense
If you have a suggestion on how to improve it that conforms with the has_entity_name requirement, I'm happy to try to implement it.
basically - internally just use any uniq_entity_id you want as it is not visible. but for the name and id just preserve that one that is set.
if friendly_name: is not set, just use entity name:
if friendly_name: is set, then use it as a prefix π
so basically like it was before π
the exemption for esphome was there because it is not used just for simple sensors or lights
So you're basically asking to restore the exemption, which makes sense. The tricky part is we canβt do that unless we remove the quality scale from ESPHome.
and I am not using any voice features at all, because it cannot work with properly configured entity names. it is always pushing these crazy names there
So effectively, what you're asking for would mean changing the architecture in Home Assistant to undo the 2023 naming changes
the nice example was the kincony with 256 channels - you cannot just prepend the device name if it is driving the whole home
I donβt have the ability to unilaterally change Home Assistantβs architecture, but I'm happy to work within the existing structure to improve what I can.
when I was reading the release notes I was wondering how this was achieved ...well π
there is a PR for subdevices https://github.com/esphome/esphome/pull/8544
did not check it yet, but this idea came after the last breaking change that was then rolled back
- it is needed when esphome is just a hub - for devices connected via ble, rs485, can,...
that HA PR linked to that looks very incomplete. It likely barely scratchs the surface on what would be needed
without getting too much off topic
Were you able to get the original entity registry entry from above?
still downloading
ha ha..maybe I could look into influxdb - I guess everything is broken as renaming entity_id is not a good idea
old one (2024.4)
{"aliases":[],"area_id":null,"categories":{},"capabilities":{"options":["Open","Closed","Opening","Closing"]},"config_entry_id":"b641feff25b89504b2d3b9eea65a00f8","config_subentry_id":null,"created_at":"1970-01-01T00:00:00+00:00","device_class":null,"device_id":"27377805d4a10b69213d1d3556453bd7","disabled_by":null,"entity_category":null,"entity_id":"select.gate","hidden_by":null,"icon":null,"id":"72aa006c0b1754ba4fb4f2f426dca648","has_entity_name":false,"labels":[],"modified_at":"1970-01-01T00:00:00+00:00","name":null,"options":{"cloud.google_assistant":{"should_expose":false},"conversation":{"should_expose":false}},"original_device_class":null,"original_icon":null,"original_name":"Gate","platform":"esphome","supported_features":0,"translation_key":null,"unique_id":"94:B9:7E:8D:97:E0-select-gate","previous_unique_id":null,"unit_of_measurement":null},
and the new one
{"aliases":[],"area_id":null,"categories":{},"capabilities":{"options":["Open","Closed","Opening","Closing"]},"config_entry_id":"b641feff25b89504b2d3b9eea65a00f8","config_subentry_id":null,"created_at":"1970-01-01T00:00:00+00:00","device_class":null,"device_id":"27377805d4a10b69213d1d3556453bd7","disabled_by":null,"entity_category":null,"entity_id":"select.mcu_gate_gate","hidden_by":null,"icon":null,"id":"72aa006c0b1754ba4fb4f2f426dca648","has_entity_name":true,"labels":[],"modified_at":"2025-04-30T21:41:15.258764+00:00","name":null,"options":{"cloud.google_assistant":{"should_expose":false},"conversation":{"should_expose":false}},"original_device_class":null,"original_icon":null,"original_name":"Gate","platform":"esphome","supported_features":0,"translation_key":null,"unique_id":"94:B9:7E:8D:97:E0-select-gate","previous_unique_id":null,"unit_of_measurement":null},
its late 2:35... if something, I will provide it on the morning π guess only way for now is to restore from backup and hope that at least entity ids will be not changed later
the nice thing on this was that I could move some functionality from one device to another and when entity id was the same the history was preserved. now it will be not possible anymore. many thanks for now π
I'll keep digging and try to replicate the entity_id changing. I haven't had any luck with downgrading/upgrading so far. That points to a larger bug in the entity registry
I've tried downgrade, upgrade, etc. I can't reproduce this. I'm not doubting there is a bug there but I have had no luck getting the entity ids to change
Still no luck. Going to need some way to reproduce this. Iβll try again tomorrow after some sleep
I have restored it from backup, maybe I can upgrade again :))
that would be great as I'm still beating my head against the wall trying to reproduce it
0315 here so I have to get some zzzs
I'll try again in the morning
If you manage to reproduce it please send the yaml file. Ill flash it on something similar and than set it up and upgrade
https://github.com/home-assistant/core/blob/dev/homeassistant/components/esphome/entity.py#L234-L243 kind reminder that we set the entity_id manually
That one PR wasn't the only thing that changed with naming
thats just the suggested one
Oh is it suggested entity id?
the entity platform is responsible for the final value
I thought you would set the entity id
entity_platform always overrides it based on what is in the registry / what it decides https://github.com/home-assistant/core/blob/3af0d6e4841f5bfa438aba799dd36a70f852e4b3/homeassistant/helpers/entity_platform.py#L903
when a unique id is set
yeah its not confusing at all π
interesting, I always thought it overwrote it
has_entity_name swapped from true if using friendly name, to true for all entities in this release?
Would that have caused it?
That should have zero effect on and already registered entity id with a unique id (unless we have a bug in core somewhere)
Iβll write a whole lot of tests in the morning. Maybe something will shake out
I still cannot reproduce it manually no matter how many times I upgrade downgrade upgrade etc
Anyways 0415 here so Iβm not going to make any more progress tonight
Gnight.
so upgraded from 2025.4.4 to 2025.5.0b1 and again many entity_id's have been changed
- if entity_id is used in the dashboard, then it's name is still the same
- if it is select.*, then it is changed even it is being used in the dashboard
- any other unused entities in the dashboard gets changed - well, not always true. only in some cases

If that helps, my Athom wall switches have selects for the config and none of the entities have changes when upgrading from 2025.4.x to 2025.5.0b0 and today b1.
yea... maybe it is related only some old devices which are missing something, so this is the reason why ha is handling newer correctly
I have created select on a newest node where are all entities fine and it added device_name as prefix
ok.. so i removed it, it was automaticlaly discovered and all entities have that device_name as prefix 
probably I cannot fight since the prefixed device_name / friendly_name is now mandatory, so I have two options. Stick with 2025.4 for my entire life, OR add friendly_name to ~50 my devices and change their names too + modify entity names and since it will add mess, then fix names too
and I don't agree that it is not a breaking change - it is changing behaviour how new (in some cases it might impact old ones) entities are named, so it is a breaking change.
Best is to start over/fix the names.
so bye bye my history and data in influxdb π
There is 1 unavailable select. Tbh, I am not sure at all this wasnβt already like that, as I donβt use Wakefield
not great decision with this prefixing. first should be the sub device support added and then this might be ok for the hub itself.
nope. friendly_name is not good. - I need that "mcu-" as device name, but I don't want that in entity_id π Ah, even it is showing friendly name on the background it is using device name, ha ha. this is so weird.
This is too big change. Need to rework common part, every config, then every device will have an ugly name - I want that hostname, otherwise it will be not matching with stickers on devices. And even it will not touch old devices every new device have to follow that standard and it will automatically prefix device_name / friendly_name, which is totally breaking everything,
Hope this change will be again reverted as it is not good
Export database to your pc, backup it
then re-generate the entities
and study how to change entity names in the database (what commands to run)
and then run it on the main database
and you'll have history
not great, not terrible, tho
I don;'t want to change their names. so I will not upgrade, because this change is messing with everything
if I can give you some motivation, I will also rename entity names since I fucked up from the start when learning HA π
my entity names are sensor.device_name_brand_sensor_type
if you like that, your choice, but HA is not apple....it should not force me to use his naming convention because somebody decided he likes it more π
in the old times I could easily move entity from one device to other and history was preserved. now even it has a device id and uniq entity id in db it needs such crazy entity id. it is so weird
maybe something to do with the storage....
still writing tests
haven't found an issue yet
I pushed up the tests https://github.com/home-assistant/core/pull/144116
Maybe someone can see something I'm missing
back to 2025.4.4. started adding friendly_name to all dev devices, but device name is prefixed instead
- restarted everything and still it is doing it wrong (in github there are many such issues and always ended autoclosed). would expect that this issue is fixed first and then you can force friendly_name...
Is there a specific issue that didn't get solved that you can point to?
these are very old, but I have exactly the same behaviour https://github.com/home-assistant/core/issues/106668 / https://github.com/home-assistant/core/issues/99937
but this is 2025.4.4. will try beta in a minute once docker gets updated
ah ok, so friendly name is just for the name, entity_id will always have its hostname. meh
yup
What is the yaml for your sensors in ESPHome? Do you prefix them with the name? Found this note: https://esphome.io/changelog/2023.2.0.html#friendly-name
name: Light 1 ..but as bdraco confirmed, it is doing it right. device name gets prefixed to entity_id, friendly_name is prefixed only to its name
I've flashed 6 different devices and upgraded and downgraded countless times
I can't get it to break
at this point I feel like I've hit a wall
even the migration is not working right at least it will force people to migrate to that new naming. nabucasa is like apple π they know what is the best for users and they will not give us any other option π
I have set name = friendly name so no issue here π¬
I really don;t understand why theyu are doing it - HA knows to which device it belongs and with the new picker it is showing all needed info about entity, so this forcing is totally unnecessary
If you post the yaml from one of the affected devices, I'll try flashing it, setting it up on 2025.4.x, and than upgrading to 2025.5.x
https://github.com/randybb/esphome-configs/blob/main/mcu-gate.yaml π but already stared with that adding friendly_name and changing names, so you won π
got it flashed
its not showing as a discovery
thats odd
nevermind it got the IP of an existing device
{"aliases":[],"area_id":null,"categories":{},"capabilities":{"options":["Open","Closed","Opening","Closing"]},"config_entry_id":"01JT9DQKNXJKDKJCED0283RQBR","config_subentry_id":null,"created_at":"2025-05-02T21:16:41.707741+00:00","device_class":null,"device_id":"0b9d8aad7c89f9fd32a8e34d8addce97","disabled_by":null,"entity_category":null,"entity_id":"select.gate","hidden_by":null,"icon":null,"id":"c01eb6b218fa5c73a5d738ad9ec9d305","has_entity_name":false,"labels":[],"modified_at":"2025-05-02T21:16:41.708468+00:00","name":null,"options":{"cloud.alexa":{"should_expose":false},"cloud.google_assistant":{"should_expose":false},"conversation":{"should_expose":false}},"original_device_class":null,"original_icon":null,"original_name":"Gate","platform":"esphome","supported_features":0,"translation_key":null,"unique_id":"1C:69:20:EA:57:50-select-gate","previous_unique_id":null,"unit_of_measurement":null},
going to update now
stayed the same for me
checking the registry
{"aliases":[],"area_id":null,"categories":{},"capabilities":{"options":["Open","Closed","Opening","Closing"]},"config_entry_id":"01JT9DQKNXJKDKJCED0283RQBR","config_subentry_id":null,"created_at":"2025-05-02T21:16:41.707741+00:00","device_class":null,"device_id":"0b9d8aad7c89f9fd32a8e34d8addce97","disabled_by":null,"entity_category":null,"entity_id":"select.gate","hidden_by":null,"icon":null,"id":"c01eb6b218fa5c73a5d738ad9ec9d305","has_entity_name":false,"labels":[],"modified_at":"2025-05-02T21:16:41.708468+00:00","name":null,"options":{"cloud.alexa":{"should_expose":false},"cloud.google_assistant":{"should_expose":false},"conversation":{"should_expose":false}},"original_device_class":null,"original_icon":null,"original_name":"Gate","platform":"esphome","supported_features":0,"translation_key":null,"unique_id":"1C:69:20:EA:57:50-select-gate","previous_unique_id":null,"unit_of_measurement":null},
I did use an esp32dev board
but I don't think that would make any different. HA doesn't treat specific boards differently
really weird π
but to be honest, I really hate these friendly names. For example I have a device in a Well and in a Shed, both are driving irrigantion - circuit A and B. and now it is called Well Irrigation A... and Shed Irrigation B π
the same for NSPanels - driving lights, but it must be called Bedroom NSPanel Light and not just Bedroom Light as before
Do you hate it? I am just shocked to hear that.
sure, I can override everything, it is just silly requirement
Every integration follows this paradigm. Complaining more and more about it isn't going to change it. It was decided long ago and every integration that creates devices and entities adopts this default naming convention.
but it doesn't mean it is right π
just accidentally upgraded to 2025.5.0b2 and it is not changing my entity_id's, so I guess it has been fixed (I slowly, as it is a loot of work, started adding friendly_name and reimporting them to make you happy π :D)
you went from 2025.4 to 2025.5.0b2 directly? Or you had some renaming done before?
The 5.0b3 has this in docs:
Add tests to ensure ESPHome entity_ids are preserved on upgrade (@solid pulsar - #144116)
yes, this issue was about that messing with entity_id's which was true with b0, but it has been fixed, so all good now π - then no, that select waas changed again..
but, unfortunately, we have to rename them anyway, because in case I would remove a device and add it back, then all entities will be created based on the new naming convention so it is better to do it now than later
@tawny fossil a question outside your - what hardware you have for CAN and how do you interface with it from HA?