Skip to content

Commit

Permalink
Simplify cleanup in Husqvarna Automower (#126666)
Browse files Browse the repository at this point in the history
Simplify cleanup in Hsuqvarna Automower
  • Loading branch information
Thomas55555 authored Sep 24, 2024
1 parent c1781cd commit c9351fd
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions homeassistant/components/husqvarna_automower/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
aiohttp_client,
config_entry_oauth2_flow,
device_registry as dr,
entity_registry as er,
)

from . import api
Expand Down Expand Up @@ -87,12 +86,6 @@ def cleanup_removed_devices(
hass: HomeAssistant, config_entry: ConfigEntry, available_devices: list[str]
) -> None:
"""Cleanup entity and device registry from removed devices."""
entity_reg = er.async_get(hass)
for entity in er.async_entries_for_config_entry(entity_reg, config_entry.entry_id):
if entity.unique_id.split("_")[0] not in available_devices:
_LOGGER.debug("Removing obsolete entity entry %s", entity.entity_id)
entity_reg.async_remove(entity.entity_id)

device_reg = dr.async_get(hass)
identifiers = {(DOMAIN, mower_id) for mower_id in available_devices}
for device in dr.async_entries_for_config_entry(device_reg, config_entry.entry_id):
Expand Down

0 comments on commit c9351fd

Please sign in to comment.