From 1ff66443fba02783d9995a0a2cada9f42944897a Mon Sep 17 00:00:00 2001
From: Dave Conway-Jones
Date: Tue, 14 Jul 2015 21:03:07 +0100
Subject: [PATCH] add be i118n version with test
---
function/rbe/README.md | 15 ++++++++++-
function/rbe/locales/en-US/rbe.json | 19 ++++++++++++++
function/rbe/package.json | 2 +-
function/rbe/rbe.html | 21 +++++++++-------
function/rbe/rbe.js | 27 ++++++++++++--------
test/function/rbe/rbe_spec.js | 39 +++++++++++++++++++++++++----
6 files changed, 97 insertions(+), 26 deletions(-)
create mode 100644 function/rbe/locales/en-US/rbe.json
diff --git a/function/rbe/README.md b/function/rbe/README.md
index e7475bf5..c43946ff 100644
--- a/function/rbe/README.md
+++ b/function/rbe/README.md
@@ -18,6 +18,9 @@ Usage
A simple node to provide report by exception (RBE) and deadband function
- only passes on data if it has changed.
+This works on a per **msg.topic** basis. This means that a single rbe node can
+handle multiple topics at the same time.
+
###RBE mode
Outputs the **msg** if the **msg.payload** is different to the previous one.
@@ -29,4 +32,14 @@ same value. Saves bandwidth, etc...
In deadband mode the incoming payload should contain a parseable *number* and is
output only if greater than + or - the *band gap* away from the previous output.
-Will accept numbers, or parseable strings like "18.4 C" or "$500"
+The deadband value can be specified as a fixed number, or a percentage. E.g. 10
+or 5% . If % mode is used then the output will only get sent if the input payload
+value is equal or more than the specified % away from the previously sent value.
+
+For example - if last sent value was 100, and deadband is set to 10% - a value
+of 110 will pass - then the next value has to be 121 in order to pass (= 110 + 10% = 121).
+
+This is mainly useful if you want to operate across multiple topics at the same
+time that may have widely differing input ranges.
+
+Will only accept numbers, or parseable strings like "18.4 C" or "$500"
diff --git a/function/rbe/locales/en-US/rbe.json b/function/rbe/locales/en-US/rbe.json
new file mode 100644
index 00000000..fda5cecd
--- /dev/null
+++ b/function/rbe/locales/en-US/rbe.json
@@ -0,0 +1,19 @@
+{
+ "rbe": {
+ "label": {
+ "func": "Mode",
+ "bandgap": "Band gap",
+ "name": "Name"
+ },
+ "eg":{
+ "bandgap": "e.g. 10 or 5%"
+ },
+ "opts": {
+ "rbe": "RBE - report if value changed",
+ "deadband": "Deadband - report if changed more than",
+ },
+ "warn": {
+ "nonumber": "no number found in payload"
+ }
+ }
+}
diff --git a/function/rbe/package.json b/function/rbe/package.json
index 5add0be8..e9a86991 100644
--- a/function/rbe/package.json
+++ b/function/rbe/package.json
@@ -1,6 +1,6 @@
{
"name" : "node-red-node-rbe",
- "version" : "0.0.4",
+ "version" : "0.0.7",
"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 2476fa95..c8fa4b4f 100644
--- a/function/rbe/rbe.html
+++ b/function/rbe/rbe.html
@@ -16,19 +16,19 @@
@@ -38,16 +38,19 @@
different to the previous one. Works on numbers and strings.
In deadband mode the incoming payload should contain a parseable number and is
output only if greater than + or - the band gap away from the previous output.
+ Deadband also supports % - only sends if the input differs by more than x% of the original value.
+ Note: This works on a per msg.topic basis. This means that a single rbe node can
+handle multiple topics at the same time.