That's because the logger does not log consecutive duplicates by default, to save DB space. There is a time limit however, which can be changed if you'd like.
Here's the logger function in
logUtil.js that handles that and comments to explain:
// filename: binary file to append new data point to
// timestamp: data point timestamp (seconds since unix epoch)
// value: data point value (signed integer)
// duplicateInterval: if provided a duplicate value is only posted after this many seconds <<<EXPLANATION
exports.postData = function post(filename, timestamp, value, duplicateInterval)
The
gateway.js app calls this here:
dbLog.postData(logfile, ts, graphValue, matchingMetric.duplicateInterval || null);
The
duplicateInterval can be used in each metric to define how often a duplicate will be logged, you will see a bunch of defaults in metrics.js like this:
duplicateInterval:3600that is 1 hour in seconds.
So ... you can change the
duplicateInterval in metrics.js BUT i strongly recommend you redefine the metric you want customized in your
own user metrics file, that's so it doesn't get overwritten in an upgrade.
By default the logger resolution is 1 second, so to make sure duplicates are logged all the time, just do duplicateInterval:1.
FWIW The null in the post() will fallback to the post() function's default of 1, but due to the merger of definitions between metrics.js and your own user metrics .js file, the merger is inclusive which means if you don't redefine it, it will retain the value in the master metrics.js.
Perhaps
duplicateInterval should be a global setting but then some folks may want this customized per metric, which complicates matters. But I hope this helps you for now.
An example user V metric with customization is already
given here. Just change 3600 to 1 in here and bob's your uncle. Make sure to restart the app from the settings page.
/*this sample metric will override that which is already defined in main metrics.js*/
/*you can redefine defaults or write your own new custom metrics in 1 or more files in this folder, separate them as you'd like - they all get merged together when the app loads*/
exports.metrics = {
V:
{
name: 'V',
regexp: /\b(?:V?BAT|VOLTS|V)\:([\d\.]+)v?\b/i,
value: '',
duplicateInterval: 1,