node-red-contrib-boolean-logic-ultimate
Advanced tools
Comparing version 1.0.24 to 1.0.25
module.exports = function (RED) { | ||
function BlinkerUltimate(config) { | ||
RED.nodes.createNode(this, config); | ||
this.config = config; | ||
var node = this; | ||
setNodeStatus({ fill: "grey", shape: "ring", text: "|| Off" }); | ||
node.tBlinker = null;// Timer Blinker | ||
node.blinkfrequency = typeof config.blinkfrequency === "undefined" ? 500 : config.blinkfrequency; | ||
node.blinkfrequency = config.blinkfrequency === undefined ? 500 : config.blinkfrequency; | ||
node.curPayload = false; | ||
node.isBlinking = false; // Is the timer running? | ||
node.stopbehaviorPIN1 = config.stopbehaviorPIN1 === undefined ? 0 : config.stopbehaviorPIN1; | ||
node.stopbehaviorPIN1 = node.stopbehaviorPIN1 == 0 ? false : true; | ||
node.stopbehaviorPIN2 = config.stopbehaviorPIN2 === undefined ? 0 : config.stopbehaviorPIN2; | ||
node.stopbehaviorPIN2 = node.stopbehaviorPIN2 == 0 ? false : true; | ||
function setNodeStatus({ fill, shape, text }) { | ||
var dDate = new Date(); | ||
node.status({ fill: fill, shape: shape, text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")" }) | ||
} | ||
setNodeStatus({ fill: "grey", shape: "ring", text: "|| Off" }); | ||
node.on('input', function (msg) { | ||
@@ -38,22 +47,18 @@ | ||
setNodeStatus({ fill: "red", shape: "dot", text: "|| Off" }); | ||
node.send({ payload: false }); | ||
node.curPayload = false; | ||
node.send([{ payload: node.stopbehaviorPIN1 }, { payload: node.stopbehaviorPIN2 }]); | ||
node.curPayload = node.stopbehaviorPIN1; | ||
} | ||
} | ||
}); | ||
node.on('close', function () { | ||
node.on('close', function (removed, done) { | ||
if (node.tBlinker !== null) clearInterval(node.tBlinker); | ||
node.isBlinking = false; | ||
node.send({ payload: false }); | ||
node.send([{ payload: node.stopbehaviorPIN1 }, { payload: node.stopbehaviorPIN2 }]); | ||
node.curPayload = node.stopbehaviorPIN1; | ||
done(); | ||
}); | ||
function setNodeStatus({ fill, shape, text }) { | ||
var dDate = new Date(); | ||
node.status({ fill: fill, shape: shape, text: text + " (" + dDate.getDate() + ", " + dDate.toLocaleTimeString() + ")" }) | ||
} | ||
function ToBoolean(value) { | ||
@@ -82,3 +87,3 @@ var res = false; | ||
node.curPayload = !node.curPayload; | ||
node.send({ payload: node.curPayload }); | ||
node.send([{ payload: node.curPayload }, { payload: !node.curPayload }]); | ||
} | ||
@@ -85,0 +90,0 @@ } |
@@ -40,3 +40,5 @@ module.exports = function (RED) { | ||
} | ||
} catch (error) { } | ||
} catch (error) { | ||
RED.log.error("BooleanLogicUltimate: error creating persistent folder. Check user permission to write to the filesystem " + error.message); | ||
} | ||
} | ||
@@ -105,3 +107,4 @@ | ||
} catch (error) { | ||
setNodeStatus({ fill: "red", shape: "dot", text: "Node cannot write to filesystem: " + error }); | ||
setNodeStatus({ fill: "red", shape: "dot", text: "Node cannot write to filesystem: " + error.message }); | ||
RED.log.error("BooleanLogicUltimate: unable to write to the filesystem. Check wether the user running node-red, has write permission to the filesysten. " + error.message); | ||
} | ||
@@ -108,0 +111,0 @@ } |
@@ -5,2 +5,7 @@ # node-red-contrib-boolean-logic-ultimate | ||
<p> | ||
<b>Version 1.0.25/b> February 2021<br/> | ||
- BlinkerUltimate: added second output pin that emits an inverted payload.</br> | ||
- BlinkerUltimate: Now you can select to send true or false on both pins once the blinker has been stopped.</br> | ||
</p> | ||
<p> | ||
<b>Version 1.0.24</b> January 2021<br/> | ||
@@ -7,0 +12,0 @@ - Maintenance release: added help links in the property windows and renamed the first property to be more clear.</br> |
{ | ||
"name": "node-red-contrib-boolean-logic-ultimate", | ||
"version": "1.0.24", | ||
"version": "1.0.25", | ||
"description": "A set of Node-RED enhanced boolean logic node, flow interruption node, blinker node, invert node, filter node, with persisten values after reboot and more.", | ||
@@ -5,0 +5,0 @@ "author": "Supergiovane (https://github.com/Supergiovane)", |
@@ -125,2 +125,6 @@ # node-red-contrib-boolean-logic-ultimate | ||
The pourpose of this node is to blink a led or something.<br /> | ||
Output PIN1 : outputs the value true/false<br/> | ||
Output PIN2 : outputs the inverted value false/true<br/> | ||
<br/> | ||
Pass <code>msg.payload = true</code> to start blinking</br> | ||
@@ -130,2 +134,6 @@ Pass <code>msg.payload = false</code> to stop blinking</br> | ||
- PIN1 stop behavior : when the blinker receives the stop message, you can select the behavior of the pin1<br/> | ||
- PIN2 stop behavior : when the blinker receives the stop message, you can select the behavior of the pin2<br/> | ||
<img src='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-boolean-logic-ultimate/master/img/blinker.png' width='60%'> | ||
@@ -132,0 +140,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
546060
551
180