@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.
36 lines (30 loc) • 1.21 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 InverterGateNode(config) {
RED.nodes.createNode(this, config);
var node = this;
this.selection = config.selection;
node.on('input', function(msg) {
//inverter-gate v2
var output = !msg.payload.Value;
// Set node status: green dot if output is true, red dot if false
var statusColor = output ? "green" : "red";
var statusText = output.toString();
node.status({fill: statusColor, shape: "dot", text: statusText});
var message = {
Value : output
}
node.send({payload: message});
});
}
RED.nodes.registerType("inverter-gate", InverterGateNode);
}