Is the a way to persist only if a value is equal or not equal so it doesn't graph in rrd4?

Is it possible to persist only certain values for an item?
I have a fronius solar set up and I am logging error codes especially error code 567 and graph that one code so I know if I am getting over voltage condition.
Over night when there is no solar the fronius sends out a warning error code 307 which is no power produced.
I end up with a graph with a lot of those error codes. It would be nice if only the 567 codes were graphed/persisted or any other code not equal to 307?

My persistence file at the moment is like this:

Strategies {
//        default = everyChange
everyHour : "* 0 * * * ?"

Items {
        // persist all items on every change and restore them from the db at startup from mapdb
        * : strategy = everyChange, everyHour

I have looked for a solution but not sound anything so maybe it cannot be done (which is OK)


You have two approaches.

  1. Prevent the Item from becoming those values you don’t want to persist. A transform profile to check the value and only if it’s a value you would want persisted allow it to pass to the Item and instead passing NULL, UNDEF, or the previous Item’s state.

  2. Exclude the Item from the .persist config and only persist the Item’s state from a Rule using the .persist() Action.

I have enhanced the persistence filters: Improve existing and add new persistence filters by J-N-K · Pull Request #3642 · openhab/openhab-core · GitHub


@ubeaut Please be aware that your definition of strategy is wrong.

everyHour : "* 0 * * * ?"

is: on every Second of the first Minute (0) of every Hour.
You want it like this:

everyHour : "0 0 * * * ?"

Of course you could set values other than 0 , for instance

everyMinute : "0 * * * * ?"
everyHour   : "1 0 * * * ?"

which may help to prevent persistence clusters (i.e. spread writing of persistence in time)

1 Like

Very cool feature!

Thanks for that I have changed the cron statement to hourly.
I even used the cron builder this time to make sure I did it correctly.