Examples of ZWaveAssociationCommandClass


Examples of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveAssociationCommandClass

        logger.debug("NODE {}: Node is not a routing node. No routes can be set.", nodeId);
        return null;
      }

      // Get the number of association groups reported by this node
    ZWaveAssociationCommandClass associationCmdClass = (ZWaveAssociationCommandClass) getCommandClass(CommandClass.ASSOCIATION);
    if(associationCmdClass == null) {
        logger.debug("NODE {}: Node has no association class. No routes can be set.", nodeId);
        return null;
      }
   
    int groups = associationCmdClass.getGroupCount();
    if(groups != 0) {
      // Loop through each association group and add the node ID to the list
      for(int group = 1; group <= groups; group++) {
        for(Integer associationNodeId : associationCmdClass.getGroupMembers(group)) {
          routedNodes.add(associationNodeId);
        }
      }
    }
View Full Code Here

Examples of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveAssociationCommandClass

              // Add the description
              record.description = database.getLabel(group.Help);
             
              // For the 'value', describe how many devices are set and the maximum allowed
              ZWaveAssociationCommandClass associationCommandClass = (ZWaveAssociationCommandClass) node
                  .getCommandClass(CommandClass.ASSOCIATION);
              int memberCnt = 0;
              List<Integer> members = associationCommandClass.getGroupMembers(group.Index);
              if(members != null)
                memberCnt = members.size();
              record.value = memberCnt + " of " + group.Maximum + " group members";

              // Add the action for refresh
              record.addAction("Refresh", "Refresh");

              records.add(record);
            }
          }
        }
      } else if (arg.startsWith("associations/association")) {
        if (database.FindProduct(node.getManufacturer(), node.getDeviceType(), node.getDeviceId()) != false) {

          String groupString = arg.substring(24);
          int nextDelimiter = groupString.indexOf('/');
          // String arg = null;
          if (nextDelimiter != -1) {
            // arg = nodeNumber.substring(nextDelimiter + 1);
            groupString = groupString.substring(0, nextDelimiter);
          }
          int groupId = Integer.parseInt(groupString);

          // Get the requested group so we have access to the
          // attributes
          List<ZWaveDbAssociationGroup> groupList = database.getProductAssociationGroups();
          if (groupList == null)
            return null;
          ZWaveDbAssociationGroup group = null;
          for (int cnt = 0; cnt < groupList.size(); cnt++) {
            if (groupList.get(cnt).Index == groupId) {
              group = groupList.get(cnt);
              break;
            }
          }

          // Return if the group wasn't found
          if (group == null)
            return null;

          // Get the group members
          ZWaveAssociationCommandClass associationCommandClass = (ZWaveAssociationCommandClass) node
              .getCommandClass(CommandClass.ASSOCIATION);

          List<Integer> members = associationCommandClass.getGroupMembers(groupId);
          for(ZWaveNode nodeList : zController.getNodes()) {
            // Don't allow an association with itself
            if(nodeList.getNodeId() == node.getNodeId())
              continue;
           
View Full Code Here

Examples of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveAssociationCommandClass

          if (database.FindProduct(node.getManufacturer(), node.getDeviceType(), node.getDeviceId()) == false) {
            logger.error("NODE {}: Error in doAction - no database found", nodeId);
            return;
          }

          ZWaveAssociationCommandClass associationCommandClass = (ZWaveAssociationCommandClass) node
              .getCommandClass(CommandClass.ASSOCIATION);
          if (associationCommandClass == null) {
            logger.error("NODE {}: Error getting associationCommandClass in doAction", nodeId);
            return;
          }

          if (splitDomain.length == 3) {
            // Request all groups for this node
            associationCommandClass.getAllAssociations();
          } else if (splitDomain.length == 4) {
            // Request a single group
            int nodeArg = Integer.parseInt(splitDomain[3].substring(11));
            this.zController.sendData(associationCommandClass.getAssociationMessage(nodeArg));
          }
        }
      }
    }
  }
View Full Code Here

Examples of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveAssociationCommandClass

          }

        }
      } else if (splitDomain.length == 5) {
        if (splitDomain[2].equals("associations")) {
          ZWaveAssociationCommandClass associationCommandClass = (ZWaveAssociationCommandClass) node
              .getCommandClass(CommandClass.ASSOCIATION);
          if (associationCommandClass == null) {
            logger.error("NODE {}: Error getting associationCommandClass in doSet", nodeId);
            return;
          }
          int assocId = Integer.parseInt(splitDomain[3].substring(11));
          int assocArg = Integer.parseInt(splitDomain[4].substring(4));

          if (value.equalsIgnoreCase("true")) {
            PendingCfg.Add(ZWaveCommandClass.CommandClass.ASSOCIATION.getKey(), nodeId, assocId, assocArg, 1);
            logger.debug("Add association index '{}' to '{}'", assocId, assocArg);
            this.zController.sendData(associationCommandClass.setAssociationMessage(assocId, assocArg));
          } else {
            PendingCfg.Add(ZWaveCommandClass.CommandClass.ASSOCIATION.getKey(), nodeId, assocId, assocArg, 0);
            logger.debug("Remove association index '{}' to '{}'", assocId, assocArg);
            this.zController.sendData(associationCommandClass.removeAssociationMessage(assocId, assocArg));
          }

          // Request an update to the group
          this.zController.sendData(associationCommandClass.getAssociationMessage(assocId));

          // When associations change, we should ensure routes are configured
          // So, let's start a network heal - just for this node right now
          if(networkMonitor != null)
            networkMonitor.healNode(nodeId);
View Full Code Here

Examples of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveAssociationCommandClass

      healing.stateNext = HealState.GETASSOCIATIONS;
      zController.requestNodeNeighborUpdate(healing.nodeId);
      break;
    case GETASSOCIATIONS:
      // Check if this node supports associations
      ZWaveAssociationCommandClass associationCommandClass = (ZWaveAssociationCommandClass) healing.node
          .getCommandClass(CommandClass.ASSOCIATION);
      if (associationCommandClass != null) {
        logger.debug("NODE {}: Heal is requesting device associations.", healing.nodeId);
        healing.stateNext = HealState.UPDATEROUTES;
        healing.event = ZWaveNetworkEvent.Type.AssociationUpdate;
        associationCommandClass.getAllAssociations();
        break;
      }
    case UPDATEROUTES:
      // Get the list of routes for this node
      healing.routeList = healing.node.getRoutingList();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.