mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Fix Freebox unsub dispatcher (#38842)
This commit is contained in:
parent
fceba0bb88
commit
f26a49eca5
@ -52,6 +52,7 @@ class FreeboxRouter:
|
|||||||
self.sensors_connection: Dict[str, float] = {}
|
self.sensors_connection: Dict[str, float] = {}
|
||||||
self.call_list: List[Dict[str, Any]] = []
|
self.call_list: List[Dict[str, Any]] = []
|
||||||
|
|
||||||
|
self._unsub_dispatcher = None
|
||||||
self.listeners = []
|
self.listeners = []
|
||||||
|
|
||||||
async def setup(self) -> None:
|
async def setup(self) -> None:
|
||||||
@ -72,7 +73,9 @@ class FreeboxRouter:
|
|||||||
|
|
||||||
# Devices & sensors
|
# Devices & sensors
|
||||||
await self.update_all()
|
await self.update_all()
|
||||||
async_track_time_interval(self.hass, self.update_all, SCAN_INTERVAL)
|
self._unsub_dispatcher = async_track_time_interval(
|
||||||
|
self.hass, self.update_all, SCAN_INTERVAL
|
||||||
|
)
|
||||||
|
|
||||||
async def update_all(self, now: Optional[datetime] = None) -> None:
|
async def update_all(self, now: Optional[datetime] = None) -> None:
|
||||||
"""Update all Freebox platforms."""
|
"""Update all Freebox platforms."""
|
||||||
@ -147,6 +150,7 @@ class FreeboxRouter:
|
|||||||
"""Close the connection."""
|
"""Close the connection."""
|
||||||
if self._api is not None:
|
if self._api is not None:
|
||||||
await self._api.close()
|
await self._api.close()
|
||||||
|
self._unsub_dispatcher()
|
||||||
self._api = None
|
self._api = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user