Fix synology_dsm i/o in event loop (#34281)
parent
5e3e4bda28
commit
77655cad0d
homeassistant/components/synology_dsm
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue