Fix synology_dsm i/o in event loop ()

pull/34287/head
J. Nick Koston 2020-04-16 01:27:41 -05:00 committed by GitHub
parent 5e3e4bda28
commit 77655cad0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions
homeassistant/components/synology_dsm

View File

@ -139,16 +139,20 @@ class SynoApi:
self._use_ssl,
dsm_version=self._api_version,
)
self.information = self._dsm.information
self.utilisation = self._dsm.utilisation
self.storage = self._dsm.storage
await self._hass.async_add_executor_job(self._fetch_device_configuration)
await self.update()
self._unsub_dispatcher = async_track_time_interval(
self._hass, self.update, SCAN_INTERVAL
)
def _fetch_device_configuration(self):
"""Fetch initial device config."""
self.information = self._dsm.information
self.utilisation = self._dsm.utilisation
self.storage = self._dsm.storage
async def async_unload(self):
"""Stop interacting with the NAS and prepare for removal from hass."""
self._unsub_dispatcher()