From 79a122e1e52578cd712f695a7e1ebe8665e9e4dc Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Sun, 2 Jul 2023 13:28:41 +0000 Subject: [PATCH] Fix Shelly button `unique_id` migration (#95707) Fix button unique_id migration --- homeassistant/components/shelly/button.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/shelly/button.py b/homeassistant/components/shelly/button.py index 1f684ce137c..ac01033f2c7 100644 --- a/homeassistant/components/shelly/button.py +++ b/homeassistant/components/shelly/button.py @@ -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]",