ソースを参照

Delete persistent states when a new unexpected topic arrrives

master
Massimo 5年前
コミット
90f9fc297f
4個のファイルの変更32行の追加22行の削除
  1. +6
    -0
      CHANGELOG.md
  2. +17
    -16
      boolean-logic-ultimate/BooleanLogicUltimate.html
  3. +8
    -5
      boolean-logic-ultimate/BooleanLogicUltimate.js
  4. +1
    -1
      package.json

+ 6
- 0
CHANGELOG.md ファイルの表示

@@ -1,5 +1,11 @@
# node-red-contrib-boolean-logic-ultimate
<p>
<b>Version 0.0.8</b><br/>
- Delete persistent states when a new unexpected topic arrrives<br/>
- Better status representation<br/>
- Better and clearer configuration UI <br/>
</p>
<p>
<b>Version 0.0.7</b><br/>
- Fixed decimal error in the "Invert" node.<br/>
</p>

+ 17
- 16
boolean-logic-ultimate/BooleanLogicUltimate.html ファイルの表示

@@ -64,30 +64,31 @@
</script>

<script type="text/x-red" data-template-name="BooleanLogicUltimate">
<div class="form-row">
<label for="node-input-inputCount"><i class="fa fa-indent"></i> Number of different topics to evaluate</label>
<input type="text" id="node-input-inputCount" placeholder="Number of different topics to consider">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-topic"><i class="fa fa-tasks"></i> Node topic</label>
<input type="text" id="node-input-topic" placeholder="Node's own topic">
</div>
<div class="form-row">
<label for="node-input-filtertrue"><i class="icon-tag"></i> Filter output result</label>
<label for="node-input-filtertrue"><i class="fa fa-filter"></i> Filter output result</label>
<select type="text" id="node-input-filtertrue" placeholder="Filter">
<option value="both">Output both 'true' and 'false' results</option>
<option value="onlytrue">Output only 'true' results</option>
</select>
</div>
<div class="form-row">
<input type="checkbox" id="node-input-persist" style="display:inline-block; width:auto; vertical-align:top;">
<label style="width:auto" for="node-input-persist"> Remember latest input values after reboot</label>
<div id="helpallga"><i> If checked, the input values are retained after a node-red reboot. That means, that if you reboot your node-red, you don't need to wait all inputs to arrive and initialize the node, before the node can output a payload.</div>
<i class="fa fa-floppy-o"></i>
<label style="width:auto" for="node-input-persist"> Remember latest input values after reboot</label> <input type="checkbox" id="node-input-persist" style="display:inline-block; width:auto; vertical-align:top;">
<div id="helpallga"><i> If checked, the input values are retained <br /> after a node-red reboot.<br/>If you reboot your node-red, <br />you don't need to wait all inputs <br />to arrive and initialize the node, <br />before the node can output a payload.</div>
</div>
<div class="form-row">
<label for="node-input-inputCount"><i class="icon-tag"></i> Number of topics</label>
<input type="text" id="node-input-inputCount" placeholder="Number of topics to consider">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-topic"><i class="icon-tag"></i> Topic</label>
<input type="text" id="node-input-topic" placeholder="Topic">
</div>

</script>

<script type="text/x-red" data-help-name="BooleanLogicUltimate">

+ 8
- 5
boolean-logic-ultimate/BooleanLogicUltimate.js ファイルの表示

@@ -24,7 +24,7 @@ module.exports = function(RED) {
node.status({fill: "blue",shape: "ring",text: "Loaded persistent states (" + Object.keys(node.state).length + " total)."});
}
} catch (error) {
node.status({fill: "grey",shape: "ring",text: "No persistent states: " + error});
node.status({fill: "grey",shape: "ring",text: "No persistent states"});
}
} else {
@@ -43,7 +43,7 @@ module.exports = function(RED) {
state[topic] = value;

// Sabe the state array to a perisistent file
// Save the state array to a perisistent file
if (this.config.persist == true) {
try {
if (!fs.existsSync("states")) fs.mkdirSync("states");
@@ -77,7 +77,10 @@ module.exports = function(RED) {
+ " [Logic]: More than the specified "
+ node.config.inputCount + " topics received, resetting. Will not output new value until " + node.config.inputCount + " new topics have been received.");
node.state = {};
DeletePersistFile(node.id);
DisplayUnkownStatus();
} else {
node.status({ fill: "green", shape: "ring", text: " Arrived topic " + keyCount + " of " + node.config.inputCount});
}
}
});
@@ -188,13 +191,13 @@ module.exports = function(RED) {
node.status(
{
fill: "gray",
shape: "dot",
text: "Unknown"
shape: "ring",
text: "Reset due to unexpected new topic"
});
};

function SetResult(_valueAND, _valueOR, _valueXOR, optionalTopic) {
node.status({fill: "green",shape: "dot",text: "Sent:("+"AND:" + _valueAND + " OR:" +_valueOR + " XOR:" +_valueXOR+")"});
node.status({fill: "green",shape: "dot",text: "(AND)" + _valueAND + " (OR)" +_valueOR + " (XOR)" +_valueXOR});
if (_valueAND!=null){
var msgAND = {

+ 1
- 1
package.json ファイルの表示

@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-boolean-logic-ultimate",
"version": "0.0.7",
"version": "0.0.8",
"description": "A set of Node-RED enhanced boolean logic, with persisten values after reboot and more",
"author": "Supergiovane (https://github.com/Supergiovane)",
"dependencies": {

読み込み中…
キャンセル
保存