From 2c08dc509f93130aaf73274bb31aabdd02ec6067 Mon Sep 17 00:00:00 2001 From: Michael <35783820+mib1185@users.noreply.github.com> Date: Wed, 21 Sep 2022 17:27:05 +0200 Subject: [PATCH] Check Surveillance Station permissions during setup of Synology DSM integration (#78884) --- homeassistant/components/synology_dsm/common.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/homeassistant/components/synology_dsm/common.py b/homeassistant/components/synology_dsm/common.py index 82f2c214804..019108c3230 100644 --- a/homeassistant/components/synology_dsm/common.py +++ b/homeassistant/components/synology_dsm/common.py @@ -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,