Drop values befor they are stored to the DB

  • Platform information:
    • Hardware: Raspberry Pi 4
    • OS: Openhabian
    • openHAB version: 5.2.1

I integrated my PV-Inverter with modbus tcp.
This works fine.
But somtimes the items get a hiccup and the values are full out of possible range of my inverter.
So if I want to see gaph it destroys it because if the power is between 0-10 kw and I get one or two values wit 10 000.
Now I have a sql script running with a cron job every 15 minutes to delete this values from the DB to be able to show a graph.
Is there a possibility to drop this values befor they are stored.

There are two ways depending on whether you want to stop it even before it gets to your Item or whether you just care about the charts.

If the former, add the state filter profile (note add-on needs to be installed) as a profile on the link between the Channel and the Item. You can define criteria to throw away values that are outside your defined thresholds so the Item doesn’t even change to the bogus value.

If the latter, the persistence configuration supports filters. You can set criteria to exclude values from being saved.

I used the persitence configuration filter and it works perfect.
No glitches any more in the DB.
Thanks a lot