node-red-contrib-dashboard-bar-chart-data
Advanced tools
Comparing version 0.9.7 to 0.9.8
@@ -100,4 +100,4 @@ module.exports = function(RED) { | ||
var reading = Number(msg.payload); | ||
var ts = msg.ts || msg.timestamp || (+ new Date()); | ||
if (ts <= 9999999999) { ts *= 1000 } //sec ts to millis ts, only works until 2286-11-20 :( | ||
var ts = msg.ts || msg.timestamp || (+ new Date()); | ||
if (ts <= 9999999999) { ts *= 1000 } //sec ts to millis ts, only works until 2286-11-20 :( | ||
var curDate = new Date(ts); | ||
@@ -136,2 +136,3 @@ saveTopic(msg.topic, store); //save topic to store (for cleaning and handling of multiple topics) | ||
else if(myNode.agg_by == "min") { | ||
if (oldVal === null) { oldVal = reading; } //Math.min() doesnt work with null values (other than max()) | ||
newVal = Math.min(oldVal, reading); | ||
@@ -138,0 +139,0 @@ } |
{ | ||
"name": "node-red-contrib-dashboard-bar-chart-data", | ||
"version": "0.9.7", | ||
"version": "0.9.8", | ||
"description": "Transforms sensor measurements or meter readings to be displayed in dashboard-chart as bar-chart", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/arneman/node-red-contrib-dashboard-bar-chart-data", |
@@ -62,10 +62,21 @@ # node-red-contrib-dashboard-bar-chart-data | ||
<h3>Clear and Restore</h3> | ||
<h3>Clear</h3> | ||
<dl> | ||
<dd>A message with the payload "clear" and the same topic like the sensor will reset the data for this specific sensor only. | ||
A message with the payload "clear" without a topic (empty string) will delete all data, so that the chart will be blank again.<br> | ||
If you put the output of this node to the input of this node (via <code>persist node</code>), the data will be restored. | ||
A message with the payload "clear" without a topic (empty string) will delete all data, so that the chart will be blank again. | ||
</dd> | ||
</dl> | ||
<h3>Restore</h3> | ||
<dl> | ||
<dd>If you put the output of this node to the input of this kind of node (via <code>persist node</code>), the data will be restored. | ||
This could be helpful to avoid getting a blank bar-chart after node-red has been restarted (reboot). | ||
</dd> | ||
</dl> | ||
<h3>Logfiles to bar-chart</h3> | ||
<dl> | ||
<dd>If msg.ts or msg.timestamp is given, this timestamp will be used for the reading instead of the current timestamp. You could use this feature to load (older) logfiles into bar-chart data. Caution: All values older than the given timestamp will be discarded => You have to start with the oldest value and will loose all values that are not inside the log files - except the current values are older than the ones from the logfile. | ||
</dd> | ||
</dl> | ||
@@ -72,0 +83,0 @@ <h3>Additional output: Sum, Min, Max, Settings</h3> |
69505
303
105