mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
fix exec missing addpayload,
improve switch null test (to include null object) check mqtt has payload before sending
This commit is contained in:
parent
87e537da90
commit
d7bdcd69fc
@ -23,6 +23,7 @@ module.exports = function(RED) {
|
|||||||
function ExecNode(n) {
|
function ExecNode(n) {
|
||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
this.cmd = (n.command || "").trim();
|
this.cmd = (n.command || "").trim();
|
||||||
|
if (n.addpay == undefined) { n.addpay = true; }
|
||||||
this.addpay = n.addpay;
|
this.addpay = n.addpay;
|
||||||
this.append = (n.append || "").trim();
|
this.append = (n.append || "").trim();
|
||||||
this.useSpawn = n.useSpawn;
|
this.useSpawn = n.useSpawn;
|
||||||
|
@ -106,7 +106,7 @@ module.exports = function(RED) {
|
|||||||
if (node.topic) {
|
if (node.topic) {
|
||||||
msg.topic = node.topic;
|
msg.topic = node.topic;
|
||||||
}
|
}
|
||||||
if ((msg.hasOwnProperty("topic")) && (typeof msg.topic === "string") && (msg.topic !== "")) { // topic must exist
|
if (msg.hasOwnProperty("payload") && (msg.hasOwnProperty("topic")) && (typeof msg.topic === "string") && (msg.topic !== "")) { // topic must exist
|
||||||
this.client.publish(msg); // send the message
|
this.client.publish(msg); // send the message
|
||||||
}
|
}
|
||||||
else { node.warn("Invalid topic specified"); }
|
else { node.warn("Invalid topic specified"); }
|
||||||
|
@ -28,8 +28,8 @@ module.exports = function(RED) {
|
|||||||
'regex': function(a, b) { return (a + "").match(new RegExp(b)); },
|
'regex': function(a, b) { return (a + "").match(new RegExp(b)); },
|
||||||
'true': function(a) { return a === true; },
|
'true': function(a) { return a === true; },
|
||||||
'false': function(a) { return a === false; },
|
'false': function(a) { return a === false; },
|
||||||
'null': function(a) { return typeof a == "undefined"; },
|
'null': function(a) { return (typeof a == "undefined" || a === null); },
|
||||||
'nnull': function(a) { return typeof a != "undefined"; },
|
'nnull': function(a) { return (typeof a != "undefined" && a !== null); },
|
||||||
'else': function(a) { return a === true; }
|
'else': function(a) { return a === true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user