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
12 changes: 9 additions & 3 deletions button-pressed.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
color: '#F3EC14',
defaults: {
name: {value:"Dash Button"},
mac: {value:""}
mac: {value:""},
interface: {value:""}
},
inputs:0,
outputs:1,
Expand All @@ -24,11 +25,16 @@

<div class="form-row">
<label for="node-input-mac">Dash MAC</label>
<input type="text" id="node-input-mac" placeholder="00:00:00:00:00:00">
<input type="text" id="node-input-mac" placeholder="00:00:00:00:00:00,00:00:00:00:00:00">
</div>
<div class="form-row">
<label for="node-input-interface">Network interface</label>
<input type="text" id="node-input-interface">
</div>

</script>

<script type="text/x-red" data-help-name="ButtonPressed">
<p>Configure the node with the Dash Button MAC Address</p>
<p>Configure the node with the Dash Button MAC Address (use comma <code>,</code> to separate multiple mac addresses)</p>
<p>You can optionally add the network interface to use for your Dash Buttons</p>
</script>
11 changes: 7 additions & 4 deletions button-pressed.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ module.exports = function(RED) {
var node = this;

var mac = config.mac || '';
// if there are mutliple addresses we split the chain
mac = mac.split(',');

var interface = config.interface || null;
console.log(mac);

var dash = dash_button(mac);
var found = function () {
console.log('Button Pressed: ' + mac);
var msg = {};
var dash = dash_button(mac, interface);
var found = function (dash_id) {
console.log('Button Pressed: ' + dash_id);
var msg = {"mac": dash_id};
node.send(msg);
};

Expand Down