-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HA 2023.7 supports default names for some entities with a device class #871
Comments
make-all
added a commit
that referenced
this issue
Jul 29, 2023
Issue #871. To make use of Home Assistant provided translations, it would be good to remove as many names from entities as possible. To distinguish between multiple entities of the same type without names, we need to use something other than the name in the identifier. This will break existing configs, so a migration will need to be written if possible to transfer entities to their new id.
make-all
added a commit
that referenced
this issue
Jul 31, 2023
Issue #871 Now that device class is used as an alternative to name to construct unique ids, the names can be removed from more entities to allow the default class based names to be used along with any translations. This commit removes only names that are an exact match for the class. Other candidates like PM2.5 are left for a later iteration once migration has been figured out, as the stub version pm2_5 differs from the class pm25, and we need to deal with the migration issues due to class being used in the unique id where the name was previously missing (mostly primary entities) before making the problem worse.
make-all
added a commit
that referenced
this issue
Aug 6, 2023
Some older entity ids will be in the entity registry with just the platform, but if they are marked with a device_class, the id will now use that. The registered entities need to be migrated to match the new ids to avoid leaving zombie entities in the registry, and losing any user customisations of name, icon etc. It may also help with finding the right entity in automations etc, but I am not sure so will still list the possiblity that automations will need updating in breaking changes. Issue #871
make-all
added a commit
that referenced
this issue
Aug 9, 2023
When translations were first added, it seemed that device class was designed to be used by default. But at least for name, this does not seem automatic. Use config_id rather than name in error messages, as name is more frequently blank now. Issue #871
make-all
added a commit
that referenced
this issue
Aug 9, 2023
Although the logic to use translated entity names is in the superclass name implementation, setting _attr_name to None results in use_device_name returning true, as that is the first condition checked, and the device name is used instead of the default entity name. This is probably an HA bug, as it becomes quite complex to use default name translations as a result, and certainly isn't per the documentation. Issue #871
make-all
added a commit
that referenced
this issue
Aug 10, 2023
- Disable name tests, as things got too complicated with the name stuff calling back into HA (which is just Mocks when testing). - set asyncio_mode to auto, as newer HA test framework requires it for async tests. - use a non-climate device for the option modification test, as there seems to be an issue with the climate one (probably to do with the naming changes). Issue #871
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently the entity name from the device config yaml file is used for both unique id and name, so we can only support one entity of each type without a name set. Since HA will now support default names, and those names will be translated already making it useful to make use of this feature, the requirement for a unique name for the unique id needs to be relaxed.
Proposal is to fall back on the device class if a name is not provided. Multiple entities of the same device class will still need a name set to disambiguate them, but they need to be disambiguated in the UI as well, so that is probably an acceptable limitation.
The text was updated successfully, but these errors were encountered: