Check Surveillance Station permissions during setup of Synology DSM integration (#78884)

pull/78895/head
Michael 2022-09-21 17:27:05 +02:00 committed by GitHub
parent c4eafb98fa
commit 2c08dc509f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -91,6 +91,16 @@ class SynoApi:
self._with_surveillance_station = bool(
self.dsm.apis.get(SynoSurveillanceStation.CAMERA_API_KEY)
)
if self._with_surveillance_station:
try:
self.dsm.surveillance_station.update()
except SYNOLOGY_CONNECTION_EXCEPTIONS:
self._with_surveillance_station = False
self.dsm.reset(SynoSurveillanceStation.API_KEY)
LOGGER.info(
"Surveillance Station found, but disabled due to missing user permissions"
)
LOGGER.debug(
"State of Surveillance_station during setup of '%s': %s",
self._entry.unique_id,