Skip to content

Commit

Permalink
migration fix
Browse files Browse the repository at this point in the history
  • Loading branch information
maciej-or committed Nov 29, 2024
1 parent 9e3c8de commit b026abc
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 b026abc

Please sign in to comment.