From b066421ed3b45d3696cb07425c1f59bd11fcc7ff Mon Sep 17 00:00:00 2001 From: Tim Schneider Date: Wed, 21 Oct 2020 22:27:01 +0200 Subject: [PATCH 1/3] auto --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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" } } From 5cae7f4a81f4b255eb57de20b00943708b2e0956 Mon Sep 17 00:00:00 2001 From: Tim Schneider Date: Mon, 26 Oct 2020 15:57:20 +0100 Subject: [PATCH 2/3] now * are allowed as wildcard for each 8-bit block --- node_helper.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/node_helper.js b/node_helper.js index 45797b3..3bcbe3a 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; } From 0e1cf15b18a47c932e6bdba25e520e8faf118893 Mon Sep 17 00:00:00 2001 From: Tim Schneider Date: Mon, 26 Oct 2020 17:16:24 +0100 Subject: [PATCH 3/3] Wildcards in mac-address are now possible Replace a 8-bit block with ** and it counts as wildcard --- node_helper.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/node_helper.js b/node_helper.js index 3bcbe3a..1d7e29a 100644 --- a/node_helper.js +++ b/node_helper.js @@ -117,14 +117,14 @@ module.exports = NodeHelper.create({ findDeviceByMacAddress: function (macAddress) { // Find first device with matching macAddress - var mac1 = macAddress.toUpperCase.split(":"); + 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")) { - var mac2 = device.macAddress.toUpperCase.split(":"); + 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] === "*" ) + equal = equal && ((mac1[j] === mac2[j]) || (mac2[j] === "**")); } if (equal) { this.log(this.name + " found device by MAC Address", device);