Persistence calculation not as expected ("wrong")

i’m trying to link my rollershutter automation to luminance.


Strategies {
   everyMinute : "0 * * * * ?"
     everyHour : "0 0 * * * ?"
      everyDay : "0 0 0 * * ?"
beforeMidnight : "0 59 23 * * ?"

Items {
    WemosD1mini_Lux :   strategy = everyMinute


2020-03-22 09:14:30.607 [vent.ItemStateChangedEvent] - WemosD1mini_Lux changed from 15427 to 15701
2020-03-22 09:15:30.640 [vent.ItemStateChangedEvent] - WemosD1mini_Lux changed from 15701 to 15649
2020-03-22 09:16:30.617 [vent.ItemStateChangedEvent] - WemosD1mini_Lux changed from 15649 to 15392
2020-03-22 09:17:30.606 [vent.ItemStateChangedEvent] - WemosD1mini_Lux changed from 15392 to 14983
2020-03-22 09:18:30.613 [vent.ItemStateChangedEvent] - WemosD1mini_Lux changed from 14983 to 14723
2020-03-22 09:18:32.572 [INFO ] [e.smarthome.model.script.Beschattung] - WemosD1mini_Lux Schnitt = 7361.5

average should be 15289,6, right? Where does the value 7361.5 come from. and what am i doing wrong?

Depends. If the stored value before was 0 and five minutes ago it would be ok.

How did you setup rrd4j and how did you try to get your average? Just using the name “xy_schnitt” (german for average) tells nothing!

i didn’t change rrd4j.cfg (file exist but it’s “empty”) so according to it should use the default configuration, right?

This is were average comes from - rule:

rule "post Update"
	Item WemosD1mini_Lux changed
	logInfo("Beschattung", "WemosD1mini_Lux Schnitt = " + WemosD1mini_Lux.averageSince(now.minusMinutes(5)).toString())

edit: this rule has nothing to do with my actual rollershutter automation, it should help me understanding persistence :slight_smile:

I see, using the .averageSince will select your DEFAULT persistence service. My guess you are using rrd4j and MapDB AND have not selected anyone of those as the default. The rule selected the first queryable service (in this case MapDB).
Try the set rrd4j as the default persistence service (PaperUI under Configuration System).

BTW: When using the default setup of rrd4j make sure you do understand when and how your stored values are consolidated! For example requesting the data for the last 24 hrs will NOT give you the actual minute-wise stored values.

thanks for the hint!
i just changed default (was mapdb before). but why is this relevant, this item is persisted only in rrd4j?
for now i just need last 5 minutes so it should be ok!

If MapDB was the default persistence service, then you are using it! My guess you did set it up to restore all items after restart.

yeah, some items (not WemosD1mini_Lux).
but doesn’t mean i can’t use the other persistence services as well, does is?

If you are not persisting this item in MapDB , this database might be used when you call it for this item.
You can use as much persistence services as you want, however you got to understand when the default is used or when you have to state the desired service explicitly ( for example when charting).


Dumb machine; I have no idea what database to use.


Dumb machine: I will do as I am instructed.

Ups, looked into the docs BUT didn’t scroll down far enough.

thank you everybody!