Fix duplicated device name in entity IDs - #10
Merged
Conversation
Migrate to has_entity_name pattern so Home Assistant does not prepend the device name twice when generating entity IDs. Move network prefix and connection type suffix into device_info.name and return only the entity description name from the name property. Fixes #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Entity IDs contained the device name twice (e.g.
device_tracker.dad_ssid_dad). The integration manually built full entity names that included the resource name, while also settingdevice_info.nameto the resource name. Modern Home Assistant generates entity IDs by prependingdevice_info.nameto the entity name, so the resource name appeared twice.Upstream report: schmittx#158, upstream fix: schmittx#159.
Fix
Migrate to the
has_entity_namepattern:_attr_has_entity_name = TrueonEeroEntity._device_name()helper used bydevice_info, so they apply to the device name instead of every entity name.nameproperty now returns onlyentity_description.name(orNonewhen the description has no name, marking the entity as the device's primary entity).nameoverride inEeroDeviceTrackerEntity— its description has no name, so the tracker becomes the primary entity and uses the device name directly.Breaking change
Existing entity IDs will change (the duplicated device-name segment goes away). Automations, dashboards, and scripts referencing the old entity IDs will need to be updated after upgrading.
Fixes #6
🤖 Generated with Claude Code