Hourly/Daily/Weekly/Monthly historical delta for barchart

Some time ago, I did a new user interface for openab, based on angular and highcharts. I am working on it again, in an attempt to improve it enough so it can be usefull to others as well. https://groups.google.com/forum/#!topic/openhab/N2JbYF6XMc0

One of the (still) unique features was barcharts based on historical delta values. This is very usefull for example to see hourly/daily/weekly/monthy power consumption.

It was implemented in a dirty way, as a REST service directly in to a custom mysql persistance, since the delta was executed in sql, for best performance.

I can see that since then, delta have been introduced in the persistance extentions, but are for single values only (right?) Found a similar discussion in HABmin2/issues/70. (Chris?)

I am considering adding this historical-delta functionality more proper this time, therefore I seek your advice.

If I do it as a persistance extention, does that mean that it will have to be included in the QueryablePersistenceService in the end, and a new method will have to be generated in all peristance impementations ? (mysql, jpa, influx,etc) Is this a good idea or is it too much of a change ?

Another idea is to keep persistance as is, and do the delta at runtime in all historic data, in a IO bundle (like io.habmin). The only problem I see here is performance, e.g. if I do a monthly delta on a year’s data, it will have to fetch everything from db and loop it. I assume code wise, it will be much simpler though.

What do you think ?

1 Like