Rule does not get historic value of item

I have a problem with a few of my items. I use two persistence services:

  • rrd4j -> default persistence
  • mapdb -> only used for restoreOnStartup

Now I have an item with an rrd4j strategy of “everyMinute”.
The item is a group item (Group1), I add it as an individual item (so without the *) as I am interested in the overall value (its a group of type Group:Number:MAX)

The individual members of the group also belong to a second group Group 2. For “Group2” there is a second rrd4j strategy, this time for the individual members, so for “Group2*”

So I think I should have a history of Group1 as I have a specific rule for this Item. And I should have history for the individual items as they belong to Group2 as well and I have a rule for that.

Now when I have a chart where I add Group1 I see the members of Group1 with a valid history.
Is there a possibility to show the actual value of the group item itself?

When I use Group1 now in my rules with something like that:
var Number maximum = Group1.maximumSince(now.minusMinutes(60), “rrd4j”).state as DecimalType

I would expect to get the maximum for this group item of the last 60min. Sometimes this works as expected. But sometimes it just provides the current state.

When it doesn’t work I tried touching my rule file (to force a reload), I tried to touch my persistence file. This does not help.
The only thing that helps is to stop OpenHab and start it again. I might have luck and it works this time… or not…

Does anyone have an idea what the problem could be?
I am using OpenHAB 2.5. I think it occurred also before on 2.4 but my rules are stricter now (I check plausibility of the historic values by comparing them to the current value), so the problem is now more obvious to me.

Thanks for your help!

Guessing you are talking about a sitemap Chart … it is deliberately simple.
If you give it a Group Item, it plots the members. There’s no way to plot the actual group.
You could use more sophisticated charting like Grafana.
Or you can copy the Group value to a “regular” Item when it changes, and persist/chart that instead.

Show us examples.
We should remember that rrdj4 does some data compression, that is what it is for, but wouldn’t expect that to cause much effect over a one hour period.

Charts show all members of the group you are charting, so you will need to create another group, add Group1 to it, and then chart the new group.

This seems very odd. Do you mean that before restarting OH, there are no values persisted, and after restarting OH, there are an hour of values available? I’m curious what you see in PersistenceViewer before and after.

Thanks for the hint, created a group containing Group1 to see the actual value. I see it now in the sitemap chart. I have valid values for the last week. Still I had the problem today in the morning.

Right now it is working again, but basically it cannot come from the persistence itself when I see the valid values in the chart at the same time where I have the problems in my rules. Really strange.

I think I solved my problem. It happened once or twice a day for one or two hours. I even saw that the chart rendered the history correctly but in my rules always the latest value was returned.

What I then tried is to completely delete my rrd4j persistence. Since then I never had the problem again…