SmartAxiom / openhab

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

Modify minimumSince, maximumSince, historicValue to return full state with timestamp, not just the value #116

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Would it be possible to modify these three APIs to return the full state and 
not just the values?

I would, e.g., like to know *when* did a temperature reach its min/max, and not 
just what the min/max value was. Or if I ask for historicValue one day ago, but 
I have just started collecting the data so may perhaps only have a few minutes 
of data points. HistoricValue then returns the oldest value, which is a few 
minutes ago, not one day ago. If the value is my power meter counter my power 
consumption calculations will be incorrect, since the time elapsed since the 
measurement was taken is just minutes and not a full day.

Returning the full state object allows me to inspect the timestamp and make 
intelligent decisions and calculations.

/Henrik Sjöstrand

Original issue reported on code.google.com by henrik.sjostrand on 3 Sep 2012 at 8:08

GoogleCodeExporter commented 8 years ago
Ok, makes sense to me.

Original comment by kai.openhab on 4 Sep 2012 at 7:58

GoogleCodeExporter commented 8 years ago
I have changed the minimum and maximum methods accordingly (changeset 
http://code.google.com/p/openhab/source/detail?r=2b31554607e5e0a0b7d3e8051b9b9cd
1bf2a638e).

I have kept historicState() though, but fixed its behavior. If you now request 
a state from the past where no state had ever been defined before, the method 
will now correctly return UnDef.NULL.

Original comment by kai.openhab on 6 Oct 2012 at 9:29