Skip to content

Commit

Permalink
[hydrawise] Support unused zones (#12275)
Browse files Browse the repository at this point in the history
* [hydrawise] Support unused zones
Fixes #12209

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
  • Loading branch information
digitaldan authored Feb 13, 2022
1 parent a7e6fe6 commit b7e064a
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,15 @@ private void updateController(Controller controller) {
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));
Expand Down

0 comments on commit b7e064a

Please sign in to comment.