Skip to content

Commit

Permalink
Remove entities that are no longer supported by a device or client.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zach Cheatham committed Feb 12, 2023
1 parent ae8f633 commit 7eebaac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions custom_components/omada/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
omada_controller = OmadaController(hass, entry)
await omada_controller.async_setup()

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

hass.data.setdefault(DOMAIN, {})[entry.entry_id] = omada_controller

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

return True


Expand Down
3 changes: 2 additions & 1 deletion custom_components/omada/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ def restore_cleanup_platform_entities(
if not mac in self.entities[description.domain][description.key]:
entity = platform_entity(mac, self, description)
entities.append(entity)
elif mac not in stored_macs or not description.allowed_fn(self, mac):
elif (mac not in stored_macs or not description.allowed_fn(self, mac)
or not description.supported_fn(self, mac)):
er.async_remove(entry.entity_id)

async_add_entities(entities)
Expand Down

0 comments on commit 7eebaac

Please sign in to comment.