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"
when
Item HeatPump_Thermalenergy_Total changed
then
// 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
HeatPump_KWH_total_hourly.postUpdate(totalDailyRolling)
end
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.
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).
I changed logging via Karaf console to DEBUG for the suggested packages:
org.eclipse.smarthome.model.heatpump.rules
and also for the the mysql persistence package:
org.openhab.persistence.mysql
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.