Ignoring out of bounds values in AVG

From my logs:

2020-01-14 15:02:19.311 [vent.ItemStateChangedEvent] - Motion01SensorTemperature changed from 20.6 °C to 0E+1 °C
2020-01-14 15:02:19.328 [GroupItemStateChangedEvent] - gTemperatureAverage changed from 14.03 to 7.17 through Motion01SensorTemperature

From my items

Group:Number:AVG gTemperatureAverage "Average Temperature [%.1f °C]" <temperature> (gTemperature)

Sometimes one or more of my temperature sensors give an erroneous value. in this case 0E+1. Because of that, the average calculated for my group goes wrong.

Is there a way i can ignore these erroneous values ? Or do i have to remove the automatic group average and create a rule that calculates the average where i can do the checks manually ?

OH 2.5.1

Need to find out why this happens. How is the item configured?

You can use a rule to evaluate the temp changes and ignore the erroneous values.

I agree of course that tackling the issue at the source is the best solution

Number:Temperature Motion01SensorTemperature "Temperature sensor" (gTemperatureAverage) {channel="zwave:device:819c77dd:node5:sensor_temperature"}

This is an example of my item. (Things are configured through Paper UI, items via cfg file)

If i cannot fix the erroneous values coming in, i will have to handle them in the rules.
Does a ‘when changed’ rule on that item (or the group it belongs to) take presedence over the AVG calculation ? Is there a way i can ‘abort’ the propagation of that erroneous value down the line ?

Try changing the item to not use the UoM e.g use Number Motion01SensorTemperature and omit the : Temperature part and see if that changes the temp errors.

It may also be possible to apply a transformation to incoming data which substitutes UNDEF for nonsense readings.
a) that’s in keeping with openHAB usage
b) Group aggregation like AVG should ignore those

1 Like