I am trying to move to Grafana and MariaDB within my openHAB configuration. In my post here
I explained how to get data from an SMA PV converter to a mysql database.
In Grafana I want to sum up the power of three phases using this sql query:
SELECT $__unixEpochGroupAlias(TimeStamp, $__interval), sum(Pac1 + Pac2 + Pac3) AS "Total Pac" FROM SpotData WHERE $__unixEpochFilter(TimeStamp, $__interval) GROUP BY 1 ORDER BY $__unixEpochGroup(TimeStamp, $__interval)
This works ok for time ranges smaller than two days:
As you can see the three phases are summed up correctly to 8.7 kW.
If I now choose a time range of says for example 7 days I get:
As you can see the sum up is wrong, it should be 9kW but it is 27.1 kW
Any hints are very welcome.