From 1b42997f46bc2db5e88b303962b88720af29a617 Mon Sep 17 00:00:00 2001 From: "Jan N. Klug" Date: Wed, 10 Jul 2024 21:25:58 +0200 Subject: [PATCH] [amazonechocontrol] Fix SecurityPanel (#574) Signed-off-by: Jan N. Klug (cherry picked from commit f77345bb6c263b64964dd062b843ee5985dcaa49) Signed-off-by: Jan N. Klug (cherry picked from commit 3761356e3a452089e6f440d6a782b48f59e1c284) 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); } } }