Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions custom_components/refoss_rpc/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Platform,
)
from homeassistant.core import CALLBACK_TYPE, Event, HomeAssistant, callback
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.debounce import Debouncer
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
Expand Down Expand Up @@ -124,17 +124,6 @@ def async_setup(self) -> None:
configuration_url=f"http://{get_host(self.entry.data[CONF_HOST])}",
)
self.device_id = device_entry.id
self.remove_old_entity()

def remove_old_entity(self) -> None:
"""Remove old entity when reload."""
entity_reg = er.async_get(self.hass)
entities = er.async_entries_for_device(
registry=entity_reg, device_id=self.device_id
)
for entity in entities:
LOGGER.debug("Removing old entity: %s", entity.entity_id)
entity_reg.async_remove(entity.entity_id)

async def shutdown(self) -> None:
"""Shutdown the coordinator."""
Expand Down