fix ring alarm state when changing modes (#573)

* fix ring alarm state when changing modes

* do not log error if security panel not found
This commit is contained in:
Alex Leeds
2023-02-22 23:20:44 -05:00
committed by GitHub
parent bc64d14f7c
commit 557a0d246e

View File

@@ -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 => {