From b7e064a8724f7d1fa5243d7979c3d5d4246b9b22 Mon Sep 17 00:00:00 2001 From: Dan Cunningham Date: Sun, 13 Feb 2022 00:15:20 -0800 Subject: [PATCH] [hydrawise] Support unused zones (#12275) * [hydrawise] Support unused zones Fixes #12209 Signed-off-by: Dan Cunningham --- .../internal/handler/HydrawiseControllerHandler.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/handler/HydrawiseControllerHandler.java b/bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/handler/HydrawiseControllerHandler.java index 3b24fc581..087b939ba 100644 --- a/bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/handler/HydrawiseControllerHandler.java +++ b/bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/handler/HydrawiseControllerHandler.java @@ -274,9 +274,15 @@ public class HydrawiseControllerHandler extends BaseThingHandler implements Hydr private void updateZones(List zones) { AtomicReference anyRunning = new AtomicReference(false); AtomicReference anySuspended = new AtomicReference(false); - int i = 1; for (Zone zone : zones) { - String group = "zone" + (i++); + // there are 12 relays per expander, expanders will have a zoneNumber like: + // 10 for expander 0, relay 10 = zone10 + // 101 for expander 1, relay 1 = zone13 + // 212 for expander 2, relay 12 = zone36 + // division of integers in Java give whole numbers, not remainders FYI + int zoneNumber = ((zone.number.value / 100) * 12) + (zone.number.value % 100); + + String group = "zone" + zoneNumber; zoneMaps.put(group, zone); logger.trace("Updateing Zone {} {} ", group, zone.name); updateGroupState(group, CHANNEL_ZONE_NAME, new StringType(zone.name));