Hi
to make influxdb more useable for queries and long time analysis I created a second database “longterm” incl. continuous queries and also included in these queries are aggregate functions like integral() to convert the data from W(att) to kWh.
Example:
CREATE CONTINUOUS QUERY “15mTrok” ON “longterm”
BEGIN
SELECT INTEGRAL(“value”) /3600000 AS value
INTO longterm.autogen.“shelly.0.SHPLG2-1#DB4210#1.Relay0.Power”
FROM iobroker.autogen.“shelly.0.SHPLG2-1#DB4210#1.Relay0.Power”
GROUP BY time(15m),*
END
But these queries uses the time stamp from the beginning of the period (15m) and stores the result of the calculation in it. This examples only effects 15 Minutes but same procedure for longer periods (weeks, months) will bring up very bad results.
In case I have “raw”-data which is already stored in kwh (electrician counter) i can make use of min(“value”) function but for aggregate function like sum(“value”) the result will also be wrong.
Can you recommend how to solve?
Big Thx!