Don’t make it too complicated
There is already a setting in watermeter configuration for this:
Parameter <NUMBER>.MaxRateValue
Default Value: 0,05
Maximum allowed change between two readings, if exceeded the last reading will be rejected. Depending on the settings of <NUMBER>.MaxRateType
the MaxRateValue
is either treated as the difference between the two measurements (AbsoluteChange
= difference) not taking the set time interval into account or as the difference normalized to the interval (RateChange
= difference per minute).
You need to adapt the settings according your water consumption.
BTW I also publish the status from watermeter to openHAB. If e.g. rate is too high, I can see a warning in openHAB: