Skip to content

Commit

Permalink
migration fix (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
maciej-or authored Nov 29, 2024
1 parent 5eb05fa commit 287fca0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion custom_components/hikvision_next/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry):
entity_registry = er.async_get(hass)
for key in old_keys:
entity_id = f"sensor.{slugify(config_entry.unique_id)}_alarm_server_{key}"
entity_registry.async_remove(entity_id)
entity = entity_registry.async_get(entity_id)
if entity:
entity_registry.async_remove(entity_id)

hass.config_entries.async_update_entry(
config_entry,
Expand Down

0 comments on commit 287fca0

Please sign in to comment.