Is there an easy way to smooth random data dropouts?

Hi there

Im running openhab 4.0.4 on a Raspi 4. I

I’ve some random data dropouts on one of my items (see pic)

The item which gets data from a sensor is just a counter. Meaning that it simply counts upwards with steps of 0.1 . So every new value coming in has to be larger or equal than the one before.

Would be possible to write a rule which compares the current value with the last one and create a new smoothed item only containing the valid numbers.

I’m wondering if there is an easier way to do this. For example by using Metadata. Up to now I wasn’t successfull in filtering out data dropouts by defining the metadata min value.

Or is there a way to simply tell openhab that the item is a counter which does count upwards?

Thanks for your ideas

Richard

Yes, that’s one way. There are lots of other ways too.

  • Exclude the Item from the persistence config and instead of a separate Item the rule will call .persist on the Item only when the new change is determined to be valid.

  • In OH 4 persistence has filters which can recognize and exclude values that are erroneous. However I’m not sure they’d work in this case because the filters work on individual values, not by comparing the current state with the last state (e.g. if the value is >1000 ignore it, not if newState < oldState).

  • You could implement this in a transform profile or a transform on the Thing itself. You’d need a script transform which returns null if the value is not valid. That will not become a state update to the Item so there’s no change and nothing gets saved.