Persistence Strategy not working

Openhab 2.2 stable.

Hi,

ive configured the following strategies:

Strategies {
    endofday : "0 59 23 ? * *"
    endofmonth : "0 59 23 L * ?"
    endofyear : "0 58 23 L DEC ?"
    default = everyChange
}

Only “endofday” seems to work. The other items are just using the default. Whats wrong with the timers?

best regards

Is this your complete .persist file? If so you are missing the part where you assign the strategies to Items.

The Quarts cron builder shows the cron expressions to be correct.

No. This is my complete persist file:

Strategies {
    endofday : "0 59 23 ? * *"
    endofmonth : "0 59 23 L * ?"
    endofyear : "0 58 23 L DEC ?"
    default = everyChange
}
Items {
    Aussentemperatur : strategy = everyChange, restoreOnStartup
    Aussentemperatur_Min : strategy = everyChange, restoreOnStartup
    Aussentemperatur_Max : strategy = everyChange, restoreOnStartup
    Aussentemperatur_TagMin : strategy = endofday, restoreOnStartup
    Aussentemperatur_TagMax : strategy = endofday, restoreOnStartup
    Aussentemperatur_MonatMin : strategy = endofmonth, restoreOnStartup
    Aussentemperatur_MonatMax : strategy = endofmonth, restoreOnStartup
    Aussentemperatur_JahrMin : strategy = endofyear, restoreOnStartup
    Aussentemperatur_JahrMax : strategy = endofyear, restoreOnStartup

    Heizung_Current : strategy = everyChange, restoreOnStartup
    Heizung_Total : strategy = everyChange, restoreOnStartup
    Heizung_Tag : strategy = endofday, restoreOnStartup
    Heizung_Monat : strategy = endofmonth, restoreOnStartup
    Heizung_Jahr : strategy = endofyear, restoreOnStartup

    Haushalt_Current : strategy = everyChange, restoreOnStartup
    Haushalt_Total : strategy = everyChange, restoreOnStartup
    Haushalt_Tag : strategy = endofday, restoreOnStartup
    Haushalt_Monat : strategy = endofmonth, restoreOnStartup
    Haushalt_Jahr : strategy = endofyear, restoreOnStartup

    Wasseruhr_Jahr : strategy = endofyear, restoreOnStartup
    Wasseruhr_Total : strategy = everyChange, restoreOnStartup
    Wasseruhr_Tag : strategy = endofday, restoreOnStartup
    Wasseruhr_Monat : strategy = endofmonth, restoreOnStartup
    Wasseruhr_Offset : strategy = everyChange, restoreOnStartup
    Wasseruhr : strategy = everyChange, restoreOnStartup

    Heizung_Starts : strategy = endofday, restoreOnStartup
    Vitocal_Betriebsstunden_Verdichter : strategy = endofday, restoreOnStartup

    Vitocal_Einschaltungen : strategy = everyChange, restoreOnStartup
    Vitocal_Einschaltungen_HK : strategy = everyChange, restoreOnStartup
    Vitocal_Einschaltungen_SL : strategy = everyChange, restoreOnStartup
    Vitocal_Einschaltungen_DLE_S1 : strategy = everyChange, restoreOnStartup
    Vitocal_Einschaltungen_DLE_S2 : strategy = everyChange, restoreOnStartup
    Vitocal_Einschaltungen_Abtauung : strategy = everyChange, restoreOnStartup
    Vitocal_Betriebsstunden_Verdichter : strategy = everyChange, restoreOnStartup
    Vitocal_Betriebsstunden_HKPumpe : strategy = everyChange, restoreOnStartup
    Vitocal_Betriebsstunden_SLPumpe : strategy = everyChange, restoreOnStartup
    Vitocal_Betriebsstunden_DLE_S1 : strategy = everyChange, restoreOnStartup
    Vitocal_Betriebsstunden_DLE_S2 : strategy = everyChange, restoreOnStartup
    Vitocal_Betriebsstunden_Belastung1 : strategy = everyChange, restoreOnStartup
    Vitocal_Betriebsstunden_Belastung2 : strategy = everyChange, restoreOnStartup
    Vitocal_Betriebsstunden_Belastung3 : strategy = everyChange, restoreOnStartup
    Vitocal_Betriebsstunden_Belastung4 : strategy = everyChange, restoreOnStartup
    Vitocal_Betriebsstunden_Belastung5 : strategy = everyChange, restoreOnStartup
    Vitocal_Betriebsstunden_Abtauung : strategy = everyChange, restoreOnStartup
    Vitocal_Betriebsstunden_Stoerung : strategy = everyChange, restoreOnStartup
    Vitocal_Aussentemperatur : strategy = everyChange, restoreOnStartup
    Vitocal_Temperatur_WW_IST : strategy = everyChange, restoreOnStartup
    Vitocal_Temperatur_Luft_VL : strategy = everyChange, restoreOnStartup
    Vitocal_Temperatur_Luft_RL : strategy = everyChange, restoreOnStartup
    Vitocal_Temperatur_HK_SOLL : strategy = everyChange, restoreOnStartup
    Vitocal_Temperatur_HK_VL : strategy = everyChange, restoreOnStartup
    Vitocal_Temperatur_HK_RL : strategy = everyChange, restoreOnStartup
    Vitocal_Temperatur_Verdampfer : strategy = everyChange, restoreOnStartup
    Vitocal_Druck_Verdampfer : strategy = everyChange, restoreOnStartup
    Vitocal_Druck_Kondensator : strategy = everyChange, restoreOnStartup
    Vitocal_Verdichter : strategy = everyChange, restoreOnStartup
    Vitocal_HKPumpe : strategy = everyChange, restoreOnStartup
    Vitocal_SLPumpe : strategy = everyChange, restoreOnStartup
    Vitocal_DLE_S1 : strategy = everyChange, restoreOnStartup
    Vitocal_DLE_S2 : strategy = everyChange, restoreOnStartup
}

This is my Database:
image

item0011 = “Heizung_Monat”

any idea?

In OH 2.3 the cron statement doesnt work either.

This is really annoying. Is it possible to debug this?

Doesn’t work how?

I know that you won’t like this (since you seem to have a preference for MSSQL and I am not answering your question), but I will write it :slight_smile:

Simplify your life and your OH2 setup by: Using InfluxDB and Grafana

In this way, you can persist everyChange of your Item states and then use Grafana to calculate & display Min/Max/Avg/Total etc. You won’t need all of these extra Items anymore and no more headaches with CRON.

You can also use Groups for persistence to simplify your .persist file. Put the selected items in a new Group called gInfluxDB and use gInfluxDB* : strategy = everyChange, restoreOnStartup in your influxdb.persist file.

You can still keep the SQL persistence alive (if needed) and since you know SQL, you will definitely find a way to migrate the existing data into the new DB (maybe using export/import).

The restoreOnStartup speed will increase (InfluxDB vs MSSQL). Although, it is even better to use MapDB for restoreOnStartup and InfluxDB for historical data.

The Statement

endofmonth : "0 59 23 L * ?"

does not work as you can see in my screenshot above.
With this stragety the item0011 should be persisted at the last day of every month at 23:59:00 but it is persisted randomly (screenshot)

Thanks for your answer!

You are right. MSSQL is my preference :slight_smile:

Your approach is to persist every change in the DB so that there is no need for monthly accumulated items. I think i could also do this with mariadb or is influx so much faster with grafana?

Yes, of course you could.

Influx is faster than MySQL (i can’t tell you by how much) and it is designed as a time-series DB (perfect for the use case of persisting states from OH2).