From 557a0d246ea62b77f23a5b244d6b032a99cc8bf7 Mon Sep 17 00:00:00 2001 From: Alex Leeds Date: Wed, 22 Feb 2023 23:20:44 -0500 Subject: [PATCH] fix ring alarm state when changing modes (#573) * fix ring alarm state when changing modes * do not log error if security panel not found --- plugins/ring/src/main.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/ring/src/main.ts b/plugins/ring/src/main.ts index 52896c29f..1cf968ee9 100644 --- a/plugins/ring/src/main.ts +++ b/plugins/ring/src/main.ts @@ -690,6 +690,19 @@ export class RingLocationDevice extends ScryptedDeviceBase implements DeviceProv } } location.onLocationMode.subscribe(updateLocationMode); + + // if the location has a base station, updates when arming/disarming are not sent to the `onLocationMode` subscription + // instead we subscribe to the security panel, which is updated during arming actions + location.getSecurityPanel().then(panel => { + panel.onData.subscribe(_ => { + location.getLocationMode().then(response => { + updateLocationMode(response.mode); + }); + }); + }).catch(error => { + // could not find a security panel for location + // not logging this error as it is a valid case to not have a security panel + }); if (location.hasAlarmBaseStation) { location.getLocationMode().then(response => {