Fix Shelly button unique_id migration (#95707)

Fix button unique_id migration
This commit is contained in:
Maciej Bieniek 2023-07-02 13:28:41 +00:00 committed by GitHub
parent 33cd44ddb7
commit 79a122e1e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,8 +92,8 @@ def async_migrate_unique_ids(
device_name = slugify(coordinator.device.name)
for key in ("reboot", "self_test", "mute", "unmute"):
if entity_entry.unique_id.startswith(device_name):
old_unique_id = entity_entry.unique_id
old_unique_id = f"{device_name}_{key}"
if entity_entry.unique_id == old_unique_id:
new_unique_id = f"{coordinator.mac}_{key}"
LOGGER.debug(
"Migrating unique_id for %s entity from [%s] to [%s]",