@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.
26 lines (20 loc) • 766 B
JavaScript
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);
}