mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +00:00
Store SB data Class. (#59266)
This commit is contained in:
parent
4e59e6c9a7
commit
012e005e0d
@ -30,6 +30,7 @@ class SwitchbotDataUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize global switchbot data updater."""
|
"""Initialize global switchbot data updater."""
|
||||||
self.switchbot_api = api
|
self.switchbot_api = api
|
||||||
|
self.switchbot_data = self.switchbot_api.GetSwitchbotDevices()
|
||||||
self.retry_count = retry_count
|
self.retry_count = retry_count
|
||||||
self.scan_timeout = scan_timeout
|
self.scan_timeout = scan_timeout
|
||||||
self.update_interval = timedelta(seconds=update_interval)
|
self.update_interval = timedelta(seconds=update_interval)
|
||||||
@ -43,7 +44,7 @@ class SwitchbotDataUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
def _update_data(self) -> dict | None:
|
def _update_data(self) -> dict | None:
|
||||||
"""Fetch device states from switchbot api."""
|
"""Fetch device states from switchbot api."""
|
||||||
|
|
||||||
return self.switchbot_api.GetSwitchbotDevices().discover(
|
return self.switchbot_data.discover(
|
||||||
retry=self.retry_count, scan_timeout=self.scan_timeout
|
retry=self.retry_count, scan_timeout=self.scan_timeout
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user