From 850121e022815ca6370d68bc37fb61a0b3a68a16 Mon Sep 17 00:00:00 2001 From: Greg Berger Date: Thu, 6 Sep 2018 15:05:59 +0200 Subject: [PATCH 1/3] configuration field for network interface --- button-pressed.html | 12 +++++++++--- button-pressed.js | 8 +++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/button-pressed.html b/button-pressed.html index fcc1210..70db751 100644 --- a/button-pressed.html +++ b/button-pressed.html @@ -4,7 +4,8 @@ color: '#F3EC14', defaults: { name: {value:"Dash Button"}, - mac: {value:""} + mac: {value:""}, + interface: {value:""} }, inputs:0, outputs:1, @@ -24,11 +25,16 @@
- + +
+
+ +
\ No newline at end of file diff --git a/button-pressed.js b/button-pressed.js index 5495b93..f2e46ee 100644 --- a/button-pressed.js +++ b/button-pressed.js @@ -8,13 +8,15 @@ module.exports = function(RED) { var node = this; var mac = config.mac || ''; + + var interface = config.interface || null; console.log(mac); - var dash = dash_button(mac); + var dash = dash_button(mac, interface); var found = function () { - console.log('Button Pressed: ' + mac); - var msg = {}; + console.log('Button Pressed: ' + dash_id); + var msg = {"mac": mac}; node.send(msg); }; From 6a63d0dc228ea808cf872822284f26f14955dcd7 Mon Sep 17 00:00:00 2001 From: Greg Berger Date: Thu, 6 Sep 2018 15:07:58 +0200 Subject: [PATCH 2/3] use multiple mac addresses (comma separated) --- button-pressed.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/button-pressed.js b/button-pressed.js index f2e46ee..ab58619 100644 --- a/button-pressed.js +++ b/button-pressed.js @@ -8,15 +8,16 @@ module.exports = function(RED) { var node = this; var mac = config.mac || ''; - + // if there are mutliple addresses we split the chain + mac.split(','); var interface = config.interface || null; console.log(mac); var dash = dash_button(mac, interface); - var found = function () { + var found = function (dash_id) { console.log('Button Pressed: ' + dash_id); - var msg = {"mac": mac}; + var msg = {"mac": dash_id}; node.send(msg); }; From ab8f5b6866547a36b2a448f987e411e094b7910a Mon Sep 17 00:00:00 2001 From: Greg Berger Date: Thu, 6 Sep 2018 15:35:19 +0200 Subject: [PATCH 3/3] fixed bug in splitting the macs string --- button-pressed.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/button-pressed.js b/button-pressed.js index ab58619..cf1a0dd 100644 --- a/button-pressed.js +++ b/button-pressed.js @@ -9,7 +9,7 @@ module.exports = function(RED) { var mac = config.mac || ''; // if there are mutliple addresses we split the chain - mac.split(','); + mac = mac.split(','); var interface = config.interface || null; console.log(mac);