everyChange does not appear to work when Item updated in a Rule

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!

I solved my problem by using:

HEM_MonthlyFinal.persist(“jdbc”)

In the rule. Still not certain why posting it doesn’t trigger a logging for everyChange…

Thinking-Out-Loud…How is the receiving field defined in your jdbc persistence ? If it is an integer then you might need to have everyUpdate for a strategy. e.g. int(29.498) == int(29.509)

I have the same problem with rrd4j. No persictence was stored with everyChange and everyUpdate from rule.

Yeah it seems to be a general issue with all persistence add-ons, although with rrd4j I think it needs to be logged everyMinute anyway, otherwise the graphs won’t work.
I did try using everyUpdate instead of everyChange but it didn’t seem to matter. Doing it within the rule works fine though.