Persistence Strategies issue

  • Platform information:
    • OS: ubuntu server 24.04
    • openhab 4.2.1 (Build)
    • openjdk version “17.0.12” 2024-07-16 LTS
    • OpenJDK Runtime Environment Zulu17.52+17-CA (build 17.0.12+7-LTS)
    • OpenJDK 64-Bit Server VM Zulu17.52+17-CA (build 17.0.12+7-LTS, mixed mode, sharing)

Hello together

I would like to write the value ‘dehumidifier_switch’ to the influx database at least every ten minutes. Unfortunately, entries are only made when the status changes.

I just can’t find the error. Sorry for the primitive question. I have read a lot in the forum, but unfortunately without success.

Does anyone have an idea what the problem could be?

Best regards
Michael

influxdb.persist:

Strategies {
    everyMinute : "0 * * * * ?"
    everyThreeMinute : "0 */3 * * * ?"
    everySixMinute : "0 */6 * * * ?"
    everyTenMinute : "0 */10 * * * ?"
    everyHour : "0 0 * * * ?"
    everyDay  : "0 0 0 * * ?"
}

Items {
    // Consumers Storage
    dehumidifier_trigger : strategy = everyTenMinute, everyChange
    dehumidifier_switch : strategy = everyTenMinute, everyChange, restoreOnStartup
    dehumidifier_power : strategy = everyTenMinute, everyChange
    .....
}

Grafana (openhab restart at ~10:57):

Did you restart openHAB after changing influxdb.persist?

Yes. I tried restarting the openhab service and made a reboot.

According to the Quartz documentation the syntax should be e.g., 0 0/10 * * * ? instead of 0 */10 * * * ?. Could be that it accepts both variants, but see if changing makes it work.

I have also tried this variant. Unfortunately, it didn’t help either.
Now I have finally reinstalled the system and run the same code again without any adjustments. Everything works perfectly again.
I could not find the cause :frowning:

Persistence is definitely not my topic of knowledge, but shouldn’t you use everUpdate instead of everyChange?

No, not necessarily, it would not solve issues with the cron based strategy.

What I would recommend is to move restoreOnStartup to mapDB persistence.
Start it with additional everyMinute strategie to make sure to have valid values. After couple of minutes configure mapDB persistence to everyChange and restoreOnStartup.
Doing this makes sure to have properly restored values even there might be an unlikely issue with any other persistence service relying on external database.