Rule seems to break persistence

Platform information:

  • Hardware: RaspberryPi 3
  • OS: Raspbian (Jessie)
  • Java Runtime Environment: openjdk version “1.8.0_152”
  • openHAB version: 2.3.0
  • Persistence: MySQL/ MariaDB on Synology NAS, also MapDB for restoreOnStartup, also tested InfluxDB (and removed it)

I had openHAB running since nearly a year without a hickup. I used it only to show values from the Luxtronik heatpump binding.

Then I added a rule and now openHAB stops working after a few hours. The current values show still in the classic UI, but it seems that persistence and the rule engine stopped working.

The rule is intended to calculat a (rolling) daily energy consumption from a cummulative value I get from the heatpump. e.g. the value steadily increases, but is only a total value, not broken down into hours or days or months.

I defined an item without binding:

Number HeatPump_KWH_total_hourly             "Daily KWH total"                           <energy>        (gHistory,gChart)

and used a rule to calculate the current daily energy consumption and bind it to the item above:

rule "KWH"
    Item HeatPump_Thermalenergy_Total changed 
    // get current total value
    var currentTotalKWH = HeatPump_Thermalenergy_Total.state
    logInfo("heatpump.rules", "Current KWH total:" + currentTotalKWH)

    // calculate difference to begin of day
    var Number totalDailyRolling = HeatPump_Thermalenergy_Total.deltaSince(now.withTimeAtStartOfDay)
    logInfo("heatpump.rules", "Rolling KWH hourly total:" + totalDailyRolling)

    // update proxy item


When I have this rule in the system, persistence and rules stop working. When I remove this rule, everything works fine.

Do I have a problem in my rule? Logging does not show anything on INFO, I also activated DEBUG … but nothing.

Thank you and Best Regards,

Please take a look here

OpenJDK is known for some issues so it is not recommended for use in conjunction with openHAB.
Please try Zulu or even better Oracle Java.

If it is not executed then quite likely yes you do.
Or it isn’t executed ?

What did you activate debug logging on ?
Would need to be org.eclipse.smarthome.model.heatpump.rules
(and to have a “.” inside your tagname might not work, that probably is a bad idea).

Thank you for the tips regarding the JDKs and the tag naming.

In fact, my rule runs and even shows the correct values, but stops after an undefined number of hours.

I enabled logging not in karaf, but in org.ops4j.pax.logging.cfg in /var/lib/openhab2/etc. There I set:

log4j2.logger.openhab.level = DEBUG


log4j2.logger.smarthome.level = DEBUG

They do not produce any error message.

In fact, my rule is not that complicated and even is validated by MS VS Code with OpenHAB Extension via LSP.


because you apply the log level command to wrong packages.

Use Karaf console to set logging as per docs for the package name string I told you, it’ll permanently store that to the same file you used to edit.

You cannot know if your rule is executed and/or what part of it is.

I changed logging via Karaf console to DEBUG for the suggested packages:


and also for the the mysql persistence package:


I am still waiting for an error to occur. Normally openHAB would stop persisting after 2-4 hours, but now still running without issues for > 18 hours.
Only thing I changed was enabling the logging.

Anybody else encountered such a behaviour?