From f77345bb6c263b64964dd062b843ee5985dcaa49 Mon Sep 17 00:00:00 2001 From: J-N-K Date: Sat, 18 May 2024 20:37:30 +0200 Subject: [PATCH] [amazonechocontrol] Fix SecurityPanel (#574) Signed-off-by: Jan N. Klug --- .../HandlerSecurityPanelController.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/smarthome/HandlerSecurityPanelController.java b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/smarthome/HandlerSecurityPanelController.java index 2734fee861..af650d458e 100644 --- a/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/smarthome/HandlerSecurityPanelController.java +++ b/bundles/org.smarthomej.binding.amazonechocontrol/src/main/java/org/smarthomej/binding/amazonechocontrol/internal/smarthome/HandlerSecurityPanelController.java @@ -85,25 +85,27 @@ public void updateChannels(String interfaceName, List stateList, Upd Boolean fireAlarmValue = null; Boolean waterAlarmValue = null; for (JsonObject state : stateList) { - if (ARM_STATE.propertyName.equals(state.get("name").getAsString())) { + String propertyValue = state.get("value").getAsJsonObject().get("value").getAsString(); + String propertyName = state.get("name").getAsString(); + if (ARM_STATE.propertyName.equals(propertyName)) { if (armStateValue == null) { armStateValue = state.get("value").getAsString(); } - } else if (BURGLARY_ALARM.propertyName.equals(state.get("name").getAsString())) { + } else if (BURGLARY_ALARM.propertyName.equals(propertyName)) { if (burglaryAlarmValue == null) { - burglaryAlarmValue = "ALARM".equals(state.get("value").getAsString()); + burglaryAlarmValue = "ALARM".equals(propertyValue); } - } else if (CARBON_MONOXIDE_ALARM.propertyName.equals(state.get("name").getAsString())) { + } else if (CARBON_MONOXIDE_ALARM.propertyName.equals(propertyName)) { if (carbonMonoxideAlarmValue == null) { - carbonMonoxideAlarmValue = "ALARM".equals(state.get("value").getAsString()); + carbonMonoxideAlarmValue = "ALARM".equals(propertyValue); } - } else if (FIRE_ALARM.propertyName.equals(state.get("name").getAsString())) { + } else if (FIRE_ALARM.propertyName.equals(propertyName)) { if (fireAlarmValue == null) { - fireAlarmValue = "ALARM".equals(state.get("value").getAsString()); + fireAlarmValue = "ALARM".equals(propertyValue); } - } else if (WATER_ALARM.propertyName.equals(state.get("name").getAsString())) { + } else if (WATER_ALARM.propertyName.equals(propertyName)) { if (waterAlarmValue == null) { - waterAlarmValue = "ALARM".equals(state.get("value").getAsString()); + waterAlarmValue = "ALARM".equals(propertyValue); } } }