OpenHAB 2.0 persistence extensions does not work

Hi,
I’m really new with openhab and try a lot, but now I have a problem with the persistence rrd4j. The persistence itself works fine and show me the data in a chart but I want to use the data in my rules as well.
I try to get the maximum value from the persistence extensions for this I use the maximumSince(now.minusHours() command. But for the maximum it looks that I do something wrong, maybe someone can help me.
I allready tryed a lot without any success, below you find my rule configuration to simple show the values in the log console.

var temp1 = Bad_Bewegungsmelder_Helligkeit.averageSince(now.minusHours(24))	
logInfo ("RuleInfo","value temp1: {}",temp1) 	
var temp2 = Bad_Bewegungsmelder_Helligkeit.maximumSince(now.minusHours(24))	 	
logInfo ("RuleInfo","value temp2: {}",temp2)

Console message:

2016-11-29 18:27:00.063 [INFO ] [ipse.smarthome.model.script.RuleInfo] - value temp1: 33.83101754015216
2016-11-29 18:27:00.099 [INFO ] [ipse.smarthome.model.script.RuleInfo] - value temp2: org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate$1@5436c0

So what do I wrong? I’m not able to get the data from this maximum since command. Thank you for any help in advance.

Thanks Jens

Is rrd4j confuigured as your default persistence? If not you need to tell it to use rrd4j in your call:

averageSince(now.minusHours(24), "rrd4j")

Hi,
thanks for your help, rrd4j is the default persistense in paperUI cconfiguration, but even with your code example it doesn’t work properly. I have still the same effect, the local variable temp1 is filled correct with the average value, but the variable temp2 is not filled with the maximum value, and only gets this string value. And the first expession is without the rrd4j attachment and works fine.

My rule code now with rrd4j attachment at maximumSince:

var temp1 = Bad_Bewegungsmelder_Helligkeit.averageSince(now.minusHours(24))	
logInfo ("RuleInfo","value temp1: {}",temp1) 
var temp2 = Bad_Bewegungsmelder_Helligkeit.maximumSince(now.minusHours(24), "rrd4j")	 	
logInfo ("RuleInfo","value temp2: {}",temp2)

Console message now:

2016-12-01 03:11:00.139 [INFO ] [ipse.smarthome.model.script.RuleInfo] - value temp1: 33.62112676056338
2016-12-01 03:11:00.188 [INFO ] [ipse.smarthome.model.script.RuleInfo] - value temp2: org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate$1@b3a980

I don’t understand this behavior, do I something else wrong or is there a general problem?

Thanks Jens

It looks like there might be something wrong with rrd4j based on this behavior.

Hey guys,
I just stumbled upon this thread while searching for the logfile pattern mentioned above. I do receive exactly the same error message when I try to get the 3days min value of one of my persitsted metrics. Only difference is that I’m using influxdb.
@Jens.R did you get your stuff up and running?

Heres my setup:
rule:

    var cheapest_sprit = diesel_jet_berliner.minimumSince(now.minusDays(3), "influxdb")
    logInfo("Sprit Preise", "Der günstigste Sprit Preis seit 3 Tagen ist: " + cheapest_sprit )

log:
2017-02-05 12:38:54.677 [INFO ] [.smarthome.model.script.Sprit Preise] - Der günstigste Sprit Preis seit 3 Tagen ist: org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate$1@35075818

The item is properly persisting in influx:

...
[1486297200,1.199],
[1486297260,1.199],
[1486297260,1.199]

Any idea how to get proper min() values in OH2 stable release using influxdb?

I hit this problem. It seems you need to access the state.

 var cheapest_sprit = diesel_jet_berliner.minimumSince(now.minusDays(3), "influxdb").state
logInfo("Sprit Preise", "Der günstigste Sprit Preis seit 3 Tagen ist: " + cheapest_sprit )
1 Like