@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.
47 lines (45 loc) • 1.75 kB
JavaScript
/*
* Copyright (c) 2025 Parallax AV Design Inc.
* All rights reserved.
*
* This software is licensed, not sold. You may not copy, modify, merge,
* publish, distribute, sublicense, or sell copies of this file or substantial
* portions of it except as expressly permitted by the LICENSE file included
* with this package. Use is restricted to building manifests for the
* Parallax Control Node-RED nodes. See LICENSE for details.
*/
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);
}