// 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;