Improve device shutdown and unload of Synology DSM integration (#65936)
* ignore errors during unload/logout * automatic host update is an info, nut debugpull/65955/head
parent
ad3b2f02b4
commit
aa9965675d
|
@ -16,6 +16,7 @@ from synology_dsm.api.storage.storage import SynoStorage
|
||||||
from synology_dsm.api.surveillance_station import SynoSurveillanceStation
|
from synology_dsm.api.surveillance_station import SynoSurveillanceStation
|
||||||
from synology_dsm.exceptions import (
|
from synology_dsm.exceptions import (
|
||||||
SynologyDSMAPIErrorException,
|
SynologyDSMAPIErrorException,
|
||||||
|
SynologyDSMException,
|
||||||
SynologyDSMLoginFailedException,
|
SynologyDSMLoginFailedException,
|
||||||
SynologyDSMRequestException,
|
SynologyDSMRequestException,
|
||||||
)
|
)
|
||||||
|
@ -237,7 +238,11 @@ class SynoApi:
|
||||||
|
|
||||||
async def async_unload(self) -> None:
|
async def async_unload(self) -> None:
|
||||||
"""Stop interacting with the NAS and prepare for removal from hass."""
|
"""Stop interacting with the NAS and prepare for removal from hass."""
|
||||||
await self._syno_api_executer(self.dsm.logout)
|
try:
|
||||||
|
await self._syno_api_executer(self.dsm.logout)
|
||||||
|
except SynologyDSMException:
|
||||||
|
# ignore API errors during logout
|
||||||
|
pass
|
||||||
|
|
||||||
async def async_update(self, now: timedelta | None = None) -> None:
|
async def async_update(self, now: timedelta | None = None) -> None:
|
||||||
"""Update function for updating API information."""
|
"""Update function for updating API information."""
|
||||||
|
|
|
@ -267,7 +267,7 @@ class SynologyDSMFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||||
and existing_entry.data[CONF_HOST] != parsed_url.hostname
|
and existing_entry.data[CONF_HOST] != parsed_url.hostname
|
||||||
and not fqdn_with_ssl_verification
|
and not fqdn_with_ssl_verification
|
||||||
):
|
):
|
||||||
_LOGGER.debug(
|
_LOGGER.info(
|
||||||
"Update host from '%s' to '%s' for NAS '%s' via SSDP discovery",
|
"Update host from '%s' to '%s' for NAS '%s' via SSDP discovery",
|
||||||
existing_entry.data[CONF_HOST],
|
existing_entry.data[CONF_HOST],
|
||||||
parsed_url.hostname,
|
parsed_url.hostname,
|
||||||
|
|
Loading…
Reference in New Issue