Line 82 of base module describes some code that should throw a warning when values change too much between updates, with a TODO of making it reject these values as well.
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);
}
}
I am experiencing this exact problem. I will occasionally get a humidity reading of over 1 million %, or a temperature reading of 1600f, or go from 72f to 16f. All of these readings last only for a single report before returning to normal. These wildly out of range values completely screw up the autoscaling of grafana.
When I go looking in the log files, I can find these events, but base module does not seem to be throwing up a warning message,
I'm not sure if this section of the code is not working, or if my logging is set to not record warnings.
Code: Select all
[2018-01-27 19:11:13.943] [D] [zway] SETDATA devices.31.data.lastReceived = 0 (0x00000000)
[2018-01-27 19:11:13.943] [D] [zway] SETDATA devices.31.instances.0.commandClasses.49.data.1.deviceScale = 1 (0x00000001)
[2018-01-27 19:11:13.944] [D] [zway] SETDATA devices.31.instances.0.commandClasses.49.data.1.scaleString = "°F"
[2018-01-27 19:11:13.944] [D] [zway] SETDATA devices.31.instances.0.commandClasses.49.data.1.val = 16.000000
[2018-01-27 19:11:13.944] [D] [zway] SETDATA devices.31.instances.0.commandClasses.49.data.1 = Empty
[2018-01-27 19:11:14.041] [I] [core] Notification: device-info (device-temperature): {"dev":"Living room Temperature","l":"16 °F","location":4,"customIcon":"flaticonset_14_15068088416114497.png"}
[2018-01-27 19:11:14.267] [I] [core] [BaseModule-22] Set lastLevel to 16 for ZWayVDev_zway_31-0-49-1 (was 71.7)
[2018-01-27 19:11:14.332] [I] [core] [InfluxDbStats-70] Update device ZWayVDev_zway_31-0-49-1
Do you have plans to update Base Module to reject these values, or is this something I should take on myself?
Please forgive my ignorance. I'm trying to teach myself programming with home automation, and this happens to be the most annoying problem I'm having right now, so this is where I'm starting out. (lucky you, huh?
)
Any advice would be much appreciated.