From 012e005e0dd5a735f9bc540cb5c492b31109affc Mon Sep 17 00:00:00 2001 From: RenierM26 <66512715+RenierM26@users.noreply.github.com> Date: Tue, 9 Nov 2021 08:00:51 +0200 Subject: [PATCH] Store SB data Class. (#59266) --- homeassistant/components/switchbot/coordinator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/switchbot/coordinator.py b/homeassistant/components/switchbot/coordinator.py index 4976af18809..e901cc539ea 100644 --- a/homeassistant/components/switchbot/coordinator.py +++ b/homeassistant/components/switchbot/coordinator.py @@ -30,6 +30,7 @@ class SwitchbotDataUpdateCoordinator(DataUpdateCoordinator): ) -> None: """Initialize global switchbot data updater.""" self.switchbot_api = api + self.switchbot_data = self.switchbot_api.GetSwitchbotDevices() self.retry_count = retry_count self.scan_timeout = scan_timeout self.update_interval = timedelta(seconds=update_interval) @@ -43,7 +44,7 @@ class SwitchbotDataUpdateCoordinator(DataUpdateCoordinator): def _update_data(self) -> dict | None: """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 )