varamfer / openhab

Automatically exported from code.google.com/p/openhab
0 stars 0 forks source link

historicState always returns the most recent value for DB4O persistence #102

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I'm on Openhab 1.0.0 on Linux and using db4o persistence to store temp values. 
In db4o.persist I have:

Strategies {
    everyMinute : "0 * * * * ?"
}

Items {
    * : strategy = restoreOnStartup
    Temp_Out : strategy = everyMinute
}

In my logs I see that the values are persisted:
23:04:00.006 DEBUG o.o.p.d.i.Db4oPersistenceService[:137] - Stored item state 
'Temp_Out' -> '18.3475'

If I query the temp values for 1 minute ago, 1 hour ago and 1 day ago using 
syntax like 'Temp_Out.historicState(now.minusMinutes(1))' I always get the last 
persisted value, not the historic value. 

I know that the values are properly persisted in the database because the 
minimumSince, maximumSince and averageSince works fine.

So there must be some bug in the historicValue for db4o.

/Henrik

Original issue reported on code.google.com by henrik.sjostrand on 20 Aug 2012 at 9:12

GoogleCodeExporter commented 8 years ago
When testing, I just always get "Uninitialized" now. Will have to analyze it in 
detail, thanks for reporting it!

Original comment by kai.openhab on 21 Aug 2012 at 8:39

GoogleCodeExporter commented 8 years ago
thanks Henrik for providing a fix yourself!

Original comment by teichsta on 28 Aug 2012 at 9:43

GoogleCodeExporter commented 8 years ago
changeset is 
http://code.google.com/p/openhab/source/detail?r=c52a1b650036b648f76e0058dfdb669
568568ed5

Original comment by teichsta on 29 Aug 2012 at 7:30