Allow editing entity name instead of friendly name #1185
Replies: 10 comments 20 replies
-
I understand the desire here, but this needs to be very carefully handled, and ideally needs to be discussed with the community, not simply delivered as a fait accompli as part of a Beta release. Anything else is going to result in further pissing off the end users, something the project can ill afford to do right now. |
Beta Was this translation helpful? Give feedback.
-
I would really dislike this personally. |
Beta Was this translation helpful? Give feedback.
-
The way it is at the moment, this proposal seems to be based on reasons which only have to do with ease/uniformity of implementation. Are there any user-facing reasons to make this change? Having these reasons included in the proposal might make it sound more useful to the masses. That said, I think the naming pattern is a matter of personal preference and I would not dare to think that there is a majority for any option. It's a good idea to have separate strings for device name, entity name etc. and it would be lovely if users could get to pick how their entities would be displayed in general, with per-entity overrides possible. I like the idea of having both the entity name and device name in entity selectors. Particularly if i could search by both (in the same input, of course). Personally, I name my entities using area/device, purpose and some differentiator (if needed). E.g. "Kitchen window", "Living room couch lights", "Washing machine power consumption" etc. The power consumption is an entity of the device "Washing machine", so the naming scheme makes sense. The Maybe users should be allowed to define/pick a default friendly naming scheme for new devices, but also be allowed to tinker friendly names on device addition. I don't think that one scheme would cover all cases even for a single user, let alone for the entire userbase. Regardless of the approach taken, what's important is that I (and others) have spent time on creating dashboards with entity names about which I don't have to think, I simply rely on photographic memory. Having them changed now would be a nuisance I would not want to deal with, if given the choice. |
Beta Was this translation helpful? Give feedback.
-
For me, I need to way to completely override whatever the backend would do automatically. I'd like to retain the ability to provide a name that's used everywhere, unless overridden e.g. on a card level. Where you maybe want a shortened name, the additional context might be provided by a heading of a section, title of a card or a device page. For example, I don't need to see "Living Room Temperature" when a card's title is "Living Room". Just showing "Temperature" then as an entity name is sufficient. This will vary on a case-by-case basis. One must distinguish between what is a display issue from an internal name. The entity ID is what is always unique. Names don't need to be. Also, entities are often linked to devices and in such cases the UI provides a way to navigate to the device to see all related entities. I'm struggling to see where this will be used: Only in built-in pages, like entities, settings, and such?
I cannot agree with this. There must be a way for a user to provide a name that fully overrides any form of automatic naming.
I'm ok with this where no name has been provided, but I think the solution needs to be refined. Simply concatening the parts isn't the best option in my view. At least include a separator (e.g. I have e.g. a bed occupancy device, call it "Bed Occupancy". It has a binary sensor, "Bed Occupied". Under this main proposal, this becomes "Bed Occupancy Bed Occupied". Doesn't look great, even though the individual names make sense. Coming from a frontend perspective, I think it would be better to have renaming elements and a kind of templating functionality. In other words, you have a pill for "device name" and a pill for "entity name" that you can drag into a name field and order and add other text in a way you want. No need for a templating language to be exposed to a user. This makes the implementation explicit instead of implicit and noted in some documentation where many users won't read it.
Why can the friendly name attribute not be retained as an override? Is there a technical reason for this? |
Beta Was this translation helpful? Give feedback.
-
Should this part be made more prominent in the proposal? That option makes this proposal something that improves on what we currently have by giving users choice between fully overriding the name vs. having the prefix. |
Beta Was this translation helpful? Give feedback.
-
I edited the proposal to offer it as an option. It was at the bottom of the previous proposal, it is now included in the proposal more clearly. |
Beta Was this translation helpful? Give feedback.
-
I've had the exact same idea for 2 years already (from the very beginning as So I obviously overwhelmingly support this proposal. I have however some additional remarks. What I don't fully like is that I think the proposal doesn't go far enough. There are two problems that I see. Friendly nameFirstly, we should be completely clear that the goal here is to eventually remove As was noted in OP That being said, we have to start somewhere, and frontend is the obvious choice here. We can transition all the core frontend functionality and then introduce a long deprecation for the custom cards. Speaking of cards, both core and custom, they should be treated with special care here. What every card should offer is a choice to the user, what context should be shown on it. Then it can always be customized in a way that makes local sense. Cards in a dedicated area section for example could be configured to omit the area context, to make the interface look clean and nice. We should also probably decide on some guidelines how the context should be displayed: multi-line or single-line, what separator to use, etc. We currently effectively use whitespace as a separator, which works well for English, but again not so much for many other languages. Name context and registriesSecondly, I'm not a fan of "Use as full name" attribute. It is very clearly designed for a backwards compatibility only usage and as such is a wasted opportunity. Instead I propose to add The idea is that this is the minimal context in which entity name makes sense. Some examples:
This context from the registry could also be used as a default for all the cards, if there are no special considerations and it wasn't reconfigured in the card by the user. In all the other interfaces (device page, area page, entity picker, etc.) frontend would be smart about what context to show and what to hide, just as it was described in the OP, but with the benefit of greater understanding as to in which context the entity name is valid. For example imagine that you have the light group entity from above and you show it in the "Kitchen" area page, you can simply show it as "Lights" instead of displaying "Kitchen Lights" redundantly. Backward compatibilityThis would off course remain backward compatible - the device_context = device.name + " " if "device" in entity.name_context else ""
area_context = area.name + " " if "area" in entity.name_context else ""
friendly_name = f"{device_context}{area_context}{entity.name}" As a result we would get for the examples above:
|
Beta Was this translation helpful? Give feedback.
-
My idea's behind this separate device and entity names. Right now, users have a hard time understanding the naming structure with devices and names in HA. Largest points of confusion:
To solve these issues, we should completely remove the current system and replace it with something that’s more intuitive to the user. Doing string replacements inside a single field behind the scenes does not make sense to anyone outside programming. SolutionEntity and Device Names
Default entity_id generation
|
Beta Was this translation helpful? Give feedback.
-
I'm not sure this is completely related to this initiative, but there are cases where something other than entity name (with/without parent device name) is suitable. As an example, Say I have a section with all the window Could this be factored into the change somehow? |
Beta Was this translation helpful? Give feedback.
-
Hi @piitaya, any follow-ups on this? Some time ago, I gave this topic some thought and shared an initial idea draft on Discord: I believe this topic goes well beyond just Frontend concerns. What would really be beneficial is the creation of a contract – essentially a naming specification – that all Open Home Foundation-certified members could adopt. Area namingAt first glance, this might seem straightforward – but it's not, especially when floors come into play. For example, consider areas like "Bathroom" that exist on multiple floors. How should this be handled?
There’s no clear consensus here yet. Device namingThis is probably the trickiest part without a clearly defined contract, since users will each have their own logic – and in many cases, they’ll all be right in their context. Consider:
That means naming should adapt to device type or context. It also gets more complex with:
These differences suggest the need for a flexible but consistent naming convention. Entity namingEntity names should ideally be auto-generated from device and area names, based on the contract – but also be compatible with multiple frontend use cases. With recent frontend changes (entity lists, displaying IDs or not, Cases: You have two bathrooms, in one you have a single smart heater:
You have one bathroom with two old-fashioned heaters, controlled by one smart switch:
You have all areas assigned to floor, but you actually have one "Kitchen" so no need to add floor name:
Etc. @piitaya I can see that currently almost everywhere a device is described by an area name. Does HA statistics tells that most users actually create and assign areas? This is great, but areas on the other hand are something that user must do manually. Don't you think that having an official document of recommended naming policy would be helpful for anyone looking on ideas how to name their entities? Eventually lots of people may have different ideas which not all will be supported by worked-out display policy. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Context
It’s been more than 2 years that the entity naming as be introduced to Home Assistant. (See blog post to announce entity naming).
Almost all core integration is using the new naming conventions and entity names translations has been introduced.
However, the new naming convention is not completely used in Home Assistant. The front-end still use the old
friendly_name
instead of using the entity, device and area registry names.Currently, according to the documentation, the friendly name is computed this way :
When a user rename the entity, the
friendly_name
is set, not theentity.name
.This behavior has some cons :
This inconsistency makes it difficult to understand for the user and most users are prefixing manually the entity name with the device name to restore the original format provided by the integration (
f"{device.name} {entity.name}"
)In the front-end, there is some hacky stuff to find and replace the old device name by the new device name in the
friendly_name
and it can lead to un-sync names.How devices and entities should be named is a frequent community discussion topic:
Proposal
The proposal is to allow user to edit the
entity.name
or thefriendly_name
. If the user choose to edit theentity.name
the automatic computation of friendly name can be preserved.In fact, renaming the full friendly name is still possible because some devices are multiple devices (shelly em or power strip) and some integrations still don't use entity naming.
It can be done by adding an option :
Use entity name as friendly name
oroverride friendly name
orignore device name
. (I could figure out a good name for this settings for now but you got the idea).Home Assistant front-end will also be updated to not use the
friendly_name
anymore and will do the computation depending of the context (see potential application below).Renaming the
entity.name
must be the default to respect thehas_entity_name
rule.The new option can be set to
true
during the migration if the renamed entity doesn't contains the device name to avoid name changes after update.The
friendly_name
will still be exposed as an attributes because many (if not all) custom cards relies on that. Voice and native app are also using this attribute.Potential applications
-
,:
)Concrete example
By default, the integration provides a name for the device and the entity
Initial values
Then the user decide to rename the entities.
Current behavior
Proposal
false
false
true
true
For that reason, many users are prefixing the device name in every renamed entity.
Potential issue
Adding a new option can complicate the entity settings.
Beta Was this translation helpful? Give feedback.
All reactions