1
0
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:
dceejay 2015-04-14 17:15:56 +01:00
parent 87e537da90
commit d7bdcd69fc
3 changed files with 4 additions and 3 deletions

View File

@ -23,6 +23,7 @@ module.exports = function(RED) {
function ExecNode(n) {
RED.nodes.createNode(this,n);
this.cmd = (n.command || "").trim();
if (n.addpay == undefined) { n.addpay = true; }
this.addpay = n.addpay;
this.append = (n.append || "").trim();
this.useSpawn = n.useSpawn;

View File

@ -106,7 +106,7 @@ module.exports = function(RED) {
if (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
}
else { node.warn("Invalid topic specified"); }

View File

@ -28,8 +28,8 @@ module.exports = function(RED) {
'regex': function(a, b) { return (a + "").match(new RegExp(b)); },
'true': function(a) { return a === true; },
'false': function(a) { return a === false; },
'null': function(a) { return typeof a == "undefined"; },
'nnull': function(a) { return typeof a != "undefined"; },
'null': function(a) { return (typeof a == "undefined" || a === null); },
'nnull': function(a) { return (typeof a != "undefined" && a !== null); },
'else': function(a) { return a === true; }
};