Skip to content

Commit

Permalink
[amazonechocontrol] Fix SecurityPanel (#574)
Browse files Browse the repository at this point in the history
Signed-off-by: Jan N. Klug <github@klug.nrw>
  • Loading branch information
J-N-K authored May 18, 2024
1 parent f4d053a commit f77345b
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,27 @@ public void updateChannels(String interfaceName, List<JsonObject> 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);
}
}
}
Expand Down

0 comments on commit f77345b

Please sign in to comment.