Skip to content

Commit

Permalink
Fix remove entry
Browse files Browse the repository at this point in the history
  • Loading branch information
kloemi committed Nov 26, 2024
1 parent 29c29f0 commit e426e32
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/samsvolleyball/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
coordinator = hass.data[DOMAIN][entry.data[CONF_REGION]]
if not coordinator.hasListener():
if not coordinator.has_listener():
coordinator = hass.data[DOMAIN].pop(entry.data[CONF_REGION])
await coordinator.disconnect()
_LOGGER.info(
Expand Down Expand Up @@ -191,3 +191,6 @@ async def game_active(self) -> bool:
if active_cb() > 0:
return True
return False

def has_listener(self) -> bool:
return len(self._listeners) > 0

0 comments on commit e426e32

Please sign in to comment.