averageSince() of past interval?

Tags: #<Tag:0x00007fc8fceb8e40>

I’m trying to fetch what the average of a specific period back in time i.e. not of the last n days but say of last Christmas eve, for example
Any clever idea how to do that in rules DSL ?

Clever, probably not. I think your best bet will be to query for the values from using the REST API and calculating the average manually.


Thanks. For now I’m persisting the average in another item and query that’s historicState.

I’ve been trying to think if there’s any value in the difference between an average for period A-B (where A is now) and average A-C to deduce B-C, but its beyond my comprehension. You do know the length of all periods,must be relevant.
We need a stats person :crazy_face:

That wouldn’t work. My application is about power metering, I want to know the average during nighttime which is fairly constant while day usage is not at all (unrelated to night values in stats terms).
Then again I’d think it should be simple to expand the persistence API with a 2nd parameter.
I created extend persistence functions to work on a past interval · Issue #2280 · openhab/openhab-core · GitHub .

1 Like