node-red-contrib-webthingsio
Version:
Set/get properties, execute actions and inject on events of your WebThings
23 lines (22 loc) • 626 B
JavaScript
module.exports = {
getInputValue: function(RED, node, config, msg) {
let value;
switch (config.inputMode) {
case 'injected':
value = msg.payload;
break;
case 'fixed':
value = config.input;
break;
case 'advanced':
value = RED.util.evaluateNodeProperty(
config.input, config.inputt, node, msg,
);
break;
}
if (typeof value !== 'string') {
value = JSON.stringify(value);
}
return value;
},
};