You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
833B

  1. module.exports = function(RED) {
  2. function SimpleOutputUltimate(config) {
  3. RED.nodes.createNode(this,config);
  4. this.config = config;
  5. var node = this;
  6. setNodeStatus( {fill: "grey" ,shape: "dot" ,text: "Waiting"});
  7. this.on('input', function (msg) {
  8. var msgTrue = RED.util.cloneMessage(msg);
  9. var msgFalse = RED.util.cloneMessage(msg);
  10. msgTrue.payload = true;
  11. msgFalse.payload = false;
  12. setNodeStatus({ fill: "green", shape: "dot", text: "Sent true/false" });
  13. node.send([msgTrue, msgFalse]);
  14. });
  15. function setNodeStatus({fill, shape, text})
  16. {
  17. var dDate = new Date();
  18. node.status({fill: fill,shape: shape,text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")"})
  19. }
  20. }
  21. RED.nodes.registerType("SimpleOutputUltimate",SimpleOutputUltimate);
  22. }