Not sure if this should be a question about persistence or rules…
I am storing Items with everyChange via jdbc persistence, and it works fine except for when an item value is updated from a rule. I am wondering if I am doing it the correct way:
The persistence file is configured as such:
Strategies {
everyMinute : “0 * * * * ?”
everyHour : “0 0 * * * ?”
everyDay : “0 0 0 * * ?”
}Items {
Baro : strategy = everyChange, restoreOnStartup
HEM_MonthlyFinal : strategy = everyChange, restoreOnStartup
}
The “Baro” variable comes via MQTT from my weatherstation, and it gets logged every time the value changes, so this is working fine.
However the “HEM_MonthlyFinal” is an item that is only updated from a rule based on the value of another item at a certain time. The events.log shows it as being updated, for example:
2017-11-02 14:21:35.020 [ItemStateChangedEvent ] - HEM_MonthlyFinal changed from 29.498 to 29.509
Yet the persistence rule never logs it, unless I modify the file to be something periodic (everyMinute, etc…).
Is there something that I need to do in the rules file in order for persistence to regard the Item as “changed”?
My rule file is thus:
rule “Reset monthly energy counters”
when
// Time cron “0 0 0 1 * ?”
Time cron “35 * * * * ?”
then
// reset any monthly devices and save the final value
postUpdate(HEM_MonthlyFinal,HEM_Energy.state)
HEM_MonthlyFinal.state=HEM_Energy.state
// HEM_Reset.sendCommand(ON)
end
Thanks!