diff --git a/function/rbe/package.json b/function/rbe/package.json index 57d0abfb..6b1af48d 100644 --- a/function/rbe/package.json +++ b/function/rbe/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-rbe", - "version" : "0.1.13", + "version" : "0.1.14", "description" : "A Node-RED node that provides report-by-exception (RBE) and deadband capability.", "dependencies" : { }, diff --git a/function/rbe/rbe.html b/function/rbe/rbe.html index 6839c83f..ecf951c2 100644 --- a/function/rbe/rbe.html +++ b/function/rbe/rbe.html @@ -41,6 +41,9 @@
topic string
if specified the function will work on a per topic basis.
+
resetany
+
if set clears the stored value for the specified msg.topic, or + all topics if msg.topic is not specified.

Outputs

diff --git a/function/rbe/rbe.js b/function/rbe/rbe.js index d68f51ff..50bfa1e8 100644 --- a/function/rbe/rbe.js +++ b/function/rbe/rbe.js @@ -18,6 +18,12 @@ module.exports = function(RED) { node.previous = {}; this.on("input",function(msg) { + if (msg.hasOwnProperty("reset")) { + if (msg.hasOwnProperty("topic") && (typeof msg.topic === "string") && (msg.topic !== "")) { + delete node.previous[msg.topic]; + } + else { node.previous = {}; } + } if (msg.hasOwnProperty("payload")) { var t = msg.topic || "_no_topic"; if ((this.func === "rbe") || (this.func === "rbei")) { diff --git a/hardware/wemo/lib/wemo.js b/hardware/wemo/lib/wemo.js index a042bfd0..f2d1eb7b 100644 --- a/hardware/wemo/lib/wemo.js +++ b/hardware/wemo/lib/wemo.js @@ -115,7 +115,7 @@ WeMoNG.prototype.start = function start() { //console.log("searching"); var _wemo = this; _wemo.setMaxListeners(0); - _wemo._client = new Client(); + _wemo._client = new Client({'explicitSocketBind': true}); _wemo._client.setMaxListeners(0); _wemo._client.on('response', function (headers, statusCode, rinfo) { var location = url.parse(headers.LOCATION); diff --git a/hardware/wemo/package.json b/hardware/wemo/package.json index 1b5b5758..e2212ed9 100644 --- a/hardware/wemo/package.json +++ b/hardware/wemo/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-wemo", - "version": "0.1.13", + "version": "0.1.14", "description": "Input and Output nodes for Belkin WeMo devices", "repository": "https://github.com/node-red/node-red-nodes/tree/master/hardware", "main": "WeMoNG.js", @@ -19,7 +19,7 @@ }, "license": "APACHE-2.0", "dependencies": { - "node-ssdp": "~2.9.1", + "node-ssdp": "~3.2.5", "request": "~2.74.0", "xml2js": "~0.4.13", "util": "~0.10.3", diff --git a/io/serialport/locales/ja/25-serial.json b/io/serialport/locales/ja/25-serial.json index 0b65a851..979c07b2 100644 --- a/io/serialport/locales/ja/25-serial.json +++ b/io/serialport/locales/ja/25-serial.json @@ -11,7 +11,7 @@ "split": "入力の分割方法", "deliver": "分割後の配信データ", "output": "出力", - "serial": "シリアル", + "serial": "serial", "none": "なし" }, "placeholder": { diff --git a/io/serialport/package.json b/io/serialport/package.json index 38d197d6..8e8eafdf 100644 --- a/io/serialport/package.json +++ b/io/serialport/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-serialport", - "version" : "0.6.1", + "version" : "0.6.2", "description" : "Node-RED nodes to talk to serial ports", "dependencies" : { "serialport" : "^6.0.4" diff --git a/test/function/rbe/rbe_spec.js b/test/function/rbe/rbe_spec.js index fa892001..e19249ab 100644 --- a/test/function/rbe/rbe_spec.js +++ b/test/function/rbe/rbe_spec.js @@ -102,6 +102,67 @@ describe('rbe node', function() { }); }); + it('should send output if queue is reset (rbe)', function(done) { + var flow = [{"id":"n1", "type":"rbe", func:"rbe", gap:"0", wires:[["n2"]] }, + {id:"n2", type:"helper"} ]; + helper.load(testNode, flow, function() { + var n1 = helper.getNode("n1"); + var n2 = helper.getNode("n2"); + var c = 0; + n2.on("input", function(msg) { + if (c === 0) { + msg.should.have.a.property("payload", "a"); + c+=1; + } + else if (c === 1) { + msg.should.have.a.property("payload", "b"); + c+=1; + } + else if (c === 2) { + msg.should.have.a.property("payload", "a"); + c+=1; + } + else if (c === 3) { + msg.should.have.a.property("payload", "b"); + c+=1; + } + else if (c === 4) { + msg.should.have.a.property("payload", "b"); + c+=1; + } + else if (c === 5) { + msg.should.have.a.property("payload", "b"); + c+=1; + } + else if (c === 6) { + msg.should.have.a.property("payload", "a"); + c+=1; + } + else { + msg.should.have.a.property("payload", "c"); + done(); + } + }); + n1.emit("input", {topic:"a", payload:"a"}); + n1.emit("input", {topic:"a", payload:"a"}); + n1.emit("input", {topic:"b", payload:"b"}); + n1.emit("input", {reset:true}); // reset all + n1.emit("input", {topic:"a", payload:"a"}); + n1.emit("input", {topic:"b", payload:"b"}); + n1.emit("input", {topic:"b", payload:"b"}); + n1.emit("input", {topic:"b", reset:""}); // reset b + n1.emit("input", {topic:"b", payload:"b"}); + n1.emit("input", {topic:"a", payload:"a"}); + n1.emit("input", {reset:""}); // reset all + n1.emit("input", {topic:"b", payload:"b"}); + n1.emit("input", {topic:"a", payload:"a"}); + n1.emit("input", {topic:"c"}); // don't reset a non topic + n1.emit("input", {topic:"b", payload:"b"}); + n1.emit("input", {topic:"a", payload:"a"}); + n1.emit("input", {topic:"c", payload:"c"}); + }); + }); + it('should only send output if x away from original value (deadbandEq)', function(done) { var flow = [{"id":"n1", "type":"rbe", func:"deadbandEq", gap:"10", inout:"out", wires:[["n2"]] }, {id:"n2", type:"helper"} ];