diff --git a/node_helper.js b/node_helper.js index 45797b3..1d7e29a 100644 --- a/node_helper.js +++ b/node_helper.js @@ -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; } diff --git a/package.json b/package.json index 6f983d8..cbd8e88 100644 --- a/package.json +++ b/package.json @@ -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" } }