[boschshc] Update active profile of intrusion detection system (#15899)

* [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>
This commit is contained in:
David Pace 2023-11-20 20:59:52 +01:00 committed by GitHub
parent 62f9f03bbf
commit ff873fff14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View 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) {

View 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