I went digging around, and found that the BaseModule module does have some code that seems related to dealing with these errors, but it is only supposed to print a message in the logs, with dropping the bad value being on the "to-do" list.
Code: Select all
// Warn on big level changes - TODO maybe deny too big changes
if (deviceType === 'sensorMultilevel') {
var diff = Math.abs(lastLevel-newLevel);
var probeType = vDev.get('metrics:probeType');
// Ignore diff for changes of more than 4 hours
if (modificationTime-lastUpdate > (4*60*60)) {
diff = 0;
}
if (
(probeType == 'luminosity' && (diff > 250 || newLevel > 1000 || newLevel < 0)) ||
(probeType == 'temperature' && (diff > 10 || newLevel > 50 || newLevel < -30)) ||
(probeType == 'humidity' && (diff > 20 || newLevel > 100 || newLevel < 5)) ||
(probeType == 'ultraviolet' && (diff > 4 || newLevel > 15 || newLevel < -1))
) {
self.error('Unlikely '+probeType+' level change from '+lastLevel+' to '+newLevel+' for '+vDev.id);
}
}