mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Fix synology_dsm i/o in event loop (#34281)
This commit is contained in:
parent
5e3e4bda28
commit
77655cad0d
@ -139,16 +139,20 @@ class SynoApi:
|
|||||||
self._use_ssl,
|
self._use_ssl,
|
||||||
dsm_version=self._api_version,
|
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()
|
await self.update()
|
||||||
|
|
||||||
self._unsub_dispatcher = async_track_time_interval(
|
self._unsub_dispatcher = async_track_time_interval(
|
||||||
self._hass, self.update, SCAN_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):
|
async def async_unload(self):
|
||||||
"""Stop interacting with the NAS and prepare for removal from hass."""
|
"""Stop interacting with the NAS and prepare for removal from hass."""
|
||||||
self._unsub_dispatcher()
|
self._unsub_dispatcher()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user