make Pi SRF topic editable/optional

This commit is contained in:
Dave Conway-Jones
2017-05-13 12:46:24 +01:00
parent 13fbfc4f22
commit d7e7756dcf
3 changed files with 8 additions and 2 deletions

View File

@@ -24,6 +24,7 @@ module.exports = function(RED) {
function PiSrfNode(n) {
RED.nodes.createNode(this, n);
this.topic = n.topic;
this.pins = n.pins;
var node = this;
@@ -36,7 +37,7 @@ module.exports = function(RED) {
if (RED.settings.verbose) { node.log("out: " + data + " :"); }
data = data.toString().trim();
if (data.length > 0) {
node.send({topic:"SRF",payload:data});
node.send({topic:node.topic, payload:data});
}
});