]> git.basschouten.com Git - openhab-addons.git/commitdiff
[boschshc] Update active profile of intrusion detection system (#15899)
authorDavid Pace <dev@davidpace.de>
Mon, 20 Nov 2023 19:59:52 +0000 (20:59 +0100)
committerGitHub <noreply@github.com>
Mon, 20 Nov 2023 19:59:52 +0000 (20:59 +0100)
* [boschshc] Update active profile of intrusion detection system

Fixes an issue that caused the active configuration profile of the
intrusion detection system not to be updated.

closes #15848

* [boschshc] add channel to control state service registration

Signed-off-by: David Pace <dev@davidpace.de>
bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/devices/intrusion/IntrusionDetectionHandler.java
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/devices/intrusion/IntrusionDetectionHandlerTest.java

index 8941c8db18e152781ecb2eb27107799f3ba45255..a8c5a49c20533a95e2317cc2e042d9ddc8e73b9b 100644 (file)
@@ -93,7 +93,7 @@ public class IntrusionDetectionHandler extends BoschSHCHandler {
                         CHANNEL_ACTIVE_CONFIGURATION_PROFILE),
                 true);
         this.registerService(intrusionDetectionControlStateService, this::updateChannels,
-                List.of(CHANNEL_ARMING_STATE));
+                List.of(CHANNEL_ARMING_STATE, CHANNEL_ACTIVE_CONFIGURATION_PROFILE));
         this.registerService(surveillanceAlarmService, this::updateChannels, List.of(CHANNEL_ALARM_STATE));
         this.registerStatelessService(armActionService);
         this.registerStatelessService(disarmActionService);
@@ -110,6 +110,7 @@ public class IntrusionDetectionHandler extends BoschSHCHandler {
 
     private void updateChannels(IntrusionDetectionControlState controlState) {
         super.updateState(CHANNEL_ARMING_STATE, new StringType(controlState.value.toString()));
+        super.updateState(CHANNEL_ACTIVE_CONFIGURATION_PROFILE, new StringType(controlState.activeProfile));
     }
 
     private void updateChannels(SurveillanceAlarmState surveillanceAlarmState) {
index 5f69b925ebf5af34bfa0e4c929919260f416f447..1e318efc7c48b9ec5d77265cd650ac410d1895d1 100644 (file)
@@ -161,6 +161,9 @@ class IntrusionDetectionHandlerTest extends AbstractBoschSHCHandlerTest<Intrusio
         verify(getCallback()).stateUpdated(
                 new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_ARMING_STATE),
                 new StringType("SYSTEM_ARMING"));
+        verify(getCallback()).stateUpdated(
+                new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_ACTIVE_CONFIGURATION_PROFILE),
+                new StringType("0"));
     }
 
     @Test