Skip to content

Commit

Permalink
fix: Build of old_unique_id during migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrapan committed Dec 1, 2024
1 parent 24f7c81 commit 136cd59
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/solarman/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@callback
def async_migrate_unique_ids(name: str, serial: str, entity_entry: RegistryEntry) -> dict[str, Any] | None:

entity_name = entity_entry.name or entity_entry.original_name
entity_name = entity_entry.original_name if entity_entry.has_entity_name or not entity_entry.original_name else entity_entry.original_name.replace(name, '').strip()
old_unique_id = '_'.join(filter(None, (name, serial, entity_name)))

if entity_entry.unique_id == old_unique_id and (new_unique_id := slugify(old_unique_id if entity_name else f"{old_unique_id}_{split_entity_id(entity_entry.entity_id)[0]}")):
Expand Down

0 comments on commit 136cd59

Please sign in to comment.