Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip association groups with 0 max members #138

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions app/core/controllers/assoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,17 @@ appController.controller('ConfigAssocController', function($scope, $filter, $rou
}
if (0x85 in instance.commandClasses) {
for (var group = 0; group < instance.commandClasses[0x85].data.groups.value; group++) {
dataService.runCmd('devices[' + nodeId + '].instances[' + index + '].commandClasses[0x85].Get(' + (group + 1) + ')', false, $scope._t('error_handling_data'), true);
if (instance.commandClasses[0x85].data[group + 1].max.value > 0) {
dataService.runCmd('devices[' + nodeId + '].instances[' + index + '].commandClasses[0x85].Get(' + (group + 1) + ')', false, $scope._t('error_handling_data'), true);
}

}
}
if (0x8e in instance.commandClasses) {
for (var group = 0; group < instance.commandClasses[0x8e].data.groups.value; group++) {
dataService.runCmd('devices[' + nodeId + '].instances[' + index + '].commandClasses[0x8e].Get(' + (group + 1) + ')', false, $scope._t('error_handling_data'), true);

if (instance.commandClasses[0x8e].data[group + 1].max.value) {
dataService.runCmd('devices[' + nodeId + '].instances[' + index + '].commandClasses[0x8e].Get(' + (group + 1) + ')', false, $scope._t('error_handling_data'), true);
}
}
}
$timeout(function() {
Expand All @@ -117,8 +121,8 @@ appController.controller('ConfigAssocController', function($scope, $filter, $rou
$scope.modalAssocAdd = function(group) {
$scope.input.groupCfg = group;
$scope.input.groupId = group.groupId;
$scope.assocAddDevices = [];
// Prepare devices and nodes

angular.forEach($scope.ZWaveAPIData.devices, function(node, nodeId) {
if (nodeId == 255 || node.data.isVirtual.value || nodeId == $scope.deviceId) {
return;
Expand Down Expand Up @@ -452,7 +456,13 @@ appController.controller('ConfigAssocController', function($scope, $filter, $rou
timeClass: updateTime > invalidateTime ? 'undef' : 'red',
remaining: (data.max.value - $filter('unique')(nodeIds).length)
};
assocGroups.push(obj);

// Don't return groups that have 0 max nodes. Happens with Aspire RF devices
// like the RFWC5
if (max || data.max.value) {
assocGroups.push(obj);
}

}
}
});
Expand Down