[hydrawise] Support unused zones (#12275)

* [hydrawise] Support unused zones
Fixes #12209

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
This commit is contained in:
Dan Cunningham 2022-02-13 00:15:20 -08:00 committed by GitHub
parent a7e6fe648d
commit b7e064a872
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -274,9 +274,15 @@ public class HydrawiseControllerHandler extends BaseThingHandler implements Hydr
private void updateZones(List<Zone> zones) {
AtomicReference<Boolean> anyRunning = new AtomicReference<Boolean>(false);
AtomicReference<Boolean> anySuspended = new AtomicReference<Boolean>(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));