Influxdb writing to value and aggregation

Hi,

I have a number of IoT devices running which feed data into Openhab which in turn uses Influxdb for persistence.

As i understand it, every item becomes a measurement in influx (aka table to use RDBMS terminology) , however, influxdb queries do not support aggregation across measurements e.g. if i have two items say A and B, i cannot get A+B from influx DB since A, B are two different measurements, so my questions are :-

  1. Can I configure Openhab (items definition) to store multiple fields per measurement e.g. Room1, Room2 etc as fields into a single measurement named Electricity_Consumption ?

  2. Alternately, can i write computed values directly to InfluxDB from an OpenHab rule (again with multiple fields per measurement) ?

1 Like

You may be able to do it natively using InfluxDB 1.2 and it’s subquery functionality:

If you’re familiar with an RDBMS, it has similar functionality to a from-clause query.

I read thru, dont think you can aggregate across measurements at the same level e.g. i understand you cant do something like

select mean(A.value) + mean(B.value) from A,B group by time(1m) which is what i need to achieve…

Would be nice if openhab wold be able to persist many items (measurements) in the same field with any database supported. You than could know at one specific timeframe, the values of many variable from one query. Very useful if you have a rule that can compute the value of a variable based on those measurements.

I’m looking for exactly the same functionality. I use the DSMR binding to read data from my electricity meter. That binding creates a “thing” for every measurement from the meter. I would like to combine those into one graph, but this is not possible. Would be great to be able to write different “series” to one “measurement” (in InfluxDB terms).

Influx is fairly simple thing which do one thing and does it right. Once you have all measurements stored separatelly you can always aggregate them. You can use any of tools available which connects to influx to either wrote new measurement or just visualize data (ie. Grafana and stacked metrics view). Additional aggregations can be done woth Kapacitor.