victronenergy / venus-influx-loader

NodeJS server that takes from MQTT into Influx, and config UI and still more
MIT License
12 stars 4 forks source link

Idea: better treatment of 1-phase / 3-phase measurements #114

Open mman opened 3 weeks ago

mman commented 3 weeks ago

Throwing this here for myself:

In current implementation of Venus Influx Loader we mirror Venus DBus paths / MQTT Topics 1:1 when storing into InfluxDB, which means that for example AC consumption is stored in InfluxDB as the following list of separate measurements:

Each of these measurements has associated tag for portalId and name identifying the installation.

Each of these measurements has only one value field obtained directly from MQTT.

In order to perform various calculations directly in Influx DB, as opposed to performing them in Grafana, it may be useful to think about reorganising these into two measurements:

And both of these having associated tags and multiple fields named L1, L2, and L3.

Total power consumption can then be computed via simple Influx select like this:

SELECT L1 + L2 + L3 FROM system/Ac/Consumption/Power ...

https://docs.influxdata.com/influxdb/v1/query_language/math_operators/