@parallaxcontrol/node-red-control
Version:
A comprehensive package of Node-RED nodes designed to seamlessly integrate with the Parallax Control Engine, offering enhanced control capabilities for AV Automation.
37 lines (35 loc) • 1.31 kB
JavaScript
module.exports = function(RED) {
function CompareStringTextNode(config) {
RED.nodes.createNode(this, config);
var node = this;
this.comparison = config.stringToMatch;
this.comparison = config.stringToMatch;
node.on('input', function(msg) {
//compare-string-text v2
if (node.comparison !== "") {
if (msg.payload.Value === node.comparison || msg.payload === node.comparison) {
//match
node.status({ fill: "green", shape: "dot", text: "Match" })
var message = {
Value : true
}
node.send({payload: message});
}
else {
//no match
node.status({ fill: "red", shape: "dot", text: "No Match" })
var message = {
Value : false
}
node.send({payload: message});
}
}
else {
node.status({ fill: "red", shape: "ring", text: "String comparison not defined." });
node.warn("Warning in Node: " + node.id + ", check node status for more information.");
return null;
}
});
}
RED.nodes.registerType("compare-string-text", CompareStringTextNode);
}