Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,16 @@ module.exports = NodeHelper.create({

findDeviceByMacAddress: function (macAddress) {
// Find first device with matching macAddress
var mac1 = macAddress.toUpperCase().split(":");
for (var i = 0; i < this.config.devices.length; i++) {
var device = this.config.devices[i];
if (device.hasOwnProperty("macAddress")) {
if (macAddress.toUpperCase() === device.macAddress.toUpperCase()){
var mac2 = device.macAddress.toUpperCase().split(":");
var equal = true;
for (var j = 0; j < mac1.length; j++) {
equal = equal && ((mac1[j] === mac2[j]) || (mac2[j] === "**"));
}
if (equal) {
this.log(this.name + " found device by MAC Address", device);
return device;
}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"ping": "^0.1.10"
},
"devDependencies": {
"grunt": "latest",
"grunt-contrib-jshint": "latest",
"grunt-contrib-nodeunit": "latest"
"grunt": "latest",
"grunt-contrib-jshint": "latest",
"grunt-contrib-nodeunit": "latest"
}
}