Fix synology_dsm availablity (#115073)

* Remove reload on update failure from synology_dsm

fixes #115062

The coordinator will retry on its own later, there is no
reason to reload here.  This was added in #42697

* fix available checks
This commit is contained in:
J. Nick Koston 2024-04-06 22:54:40 -10:00 committed by Franck Nijhof
parent d6793a756f
commit 75127105b9
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
6 changed files with 6 additions and 17 deletions

View File

@ -116,7 +116,7 @@ class SynoDSMSecurityBinarySensor(SynoDSMBinarySensor):
@property
def available(self) -> bool:
"""Return True if entity is available."""
return bool(self._api.security)
return bool(self._api.security) and super().available
@property
def extra_state_attributes(self) -> dict[str, str]:

View File

@ -108,7 +108,7 @@ class SynoDSMCamera(SynologyDSMBaseEntity[SynologyDSMCameraUpdateCoordinator], C
@property
def available(self) -> bool:
"""Return the availability of the camera."""
return self.camera_data.is_enabled and self.coordinator.last_update_success
return self.camera_data.is_enabled and super().available
@property
def is_recording(self) -> bool:

View File

@ -286,18 +286,7 @@ class SynoApi:
async def async_update(self) -> None:
"""Update function for updating API information."""
try:
await self._update()
except SYNOLOGY_CONNECTION_EXCEPTIONS as err:
LOGGER.debug(
"Connection error during update of '%s' with exception: %s",
self._entry.unique_id,
err,
)
LOGGER.warning(
"Connection error during update, fallback by reloading the entry"
)
await self._hass.config_entries.async_reload(self._entry.entry_id)
await self._update()
async def _update(self) -> None:
"""Update function for updating API information."""

View File

@ -366,7 +366,7 @@ class SynoDSMUtilSensor(SynoDSMSensor):
@property
def available(self) -> bool:
"""Return True if entity is available."""
return bool(self._api.utilisation)
return bool(self._api.utilisation) and super().available
class SynoDSMStorageSensor(SynologyDSMDeviceEntity, SynoDSMSensor):

View File

@ -98,7 +98,7 @@ class SynoDSMSurveillanceHomeModeToggle(
@property
def available(self) -> bool:
"""Return True if entity is available."""
return bool(self._api.surveillance_station)
return bool(self._api.surveillance_station) and super().available
@property
def device_info(self) -> DeviceInfo:

View File

@ -59,7 +59,7 @@ class SynoDSMUpdateEntity(
@property
def available(self) -> bool:
"""Return True if entity is available."""
return bool(self._api.upgrade)
return bool(self._api.upgrade) and super().available
@property
def installed_version(self) -> str | None: