[SOLVED] Persistence Strategy

Can someone please help me with a persistance strategy ?

I need to log every minutes from 06:00 in the morning to 21:00 in the evening outside that time frame nothing is logged.

Best Nanna

1 Like
Strategies {
        everyHour : "0 0 * * * ?"
        everyDay  : "0 0 0 * * ?"
        myStrategy : "0 * 6-21 ? * * *"

        // if no strategy is specified for an Item entry below, the default list will be used
       default = everyChange

You can use:


To generate openHAB compatible cron expressions


Thanks - the free formatter is great :slight_smile:

Watch out, this will trigger every minute from 6:00 until 21:59

Is there a way to persist the value of an item based on a condition - Eg. persist if the value is between 0 and 8 ?

Ok - it doesn’t have to be accurate in my case, at least not by the minute :slight_smile:

Not that I am aware.
There is a workaround with the persist method
But myItem must not be in the persitence configuration!

rule "persist between values"
    Item myItem changed
    if (myItem.state > 0 && myItem.state < 8) myItem.persist

Thanks - I will give it a try :slight_smile:

Oh I have two persist services rrd4j and influxdb how do I choose were to store ?


1 Like

Would it look like this if I want to store in Influxdb ?


But if you want to persist between 6:00 and 21:00 you will need to add this in the rule because you need to remove the item from the persist file for this to work

Great - I will try to get this to work.

Thanx for your time :slight_smile:

Works Perfect :slight_smile:

Please mark the solution post, thanks

Using such a explicit strategy (storing only between houses and if between values) does not work with rrd4j since this persistence needs a value each and every minute.

Well, in fact, it will work, but if drawing a chart for this data the chart will be empty :slight_smile:

In my case I have an Solar inverter, when there is not sufficient sun the inverter generates “fake” values and therefore I want to filter out values out of the range og 0-8 Kw - it works perfect not :slight_smile:

1 Like

Well, I should have been more precise :slight_smile:

If drawing a chart with the builtin charting for Basic UI/Classic UI the chart will stay empty…

I am trying this out…

rule “persist IF”


Item Utility_Sump_Total received update


if (Utility_Sump_Total > 0) Utility_Sump_Total.persist("influxdb")


but I am getting the following error, any suggestions ?

2021-04-28 11:14:11.485 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘persist IF’: Unknown variable or command ‘>’; line 379, column 9, length 22