Hi,
I have a problem with how influxdb is grouping data. Let me start by saying that I am using a project called SBFSpot to read data from an invertor (with solar panels attached). Al this data is written to csv files. Telegraf reads these csv’s and put them inside influxdb. I read powergeneration, currents, voltage relay status,… The tool creates 3 csv’s:
- Month data: contains one line per day with power generated for that day.
- Spot data: Live data from the invertor like currents ac/dc, voltages ac/dc, power, relay status. Should be measured every minute. But often the values are just 0 (still looking into that).
- Day data, contains power generated in the last 5 min.
Data collection started on 8th november 2019. Before that there should be no data at al as I didnt have the solar panels yet. I also recently updated chronograf, influxdb and grafana and besides that I cleaned up a bit in the db and reimported all the data.
Now over to the issue. My goal is to show the power generated every month. So I need to make a sum of the last field of the file that contains the month data. To get there I used several steps. First show what data is present:
SELECT “kWh” FROM “file” WHERE “month”=~ /kas.lan*/ FILL(null)
name: file
time kWh
1573171200000000000 11.357
1573257600000000000 4.1
1573344000000000000 10.617
1573430400000000000 5.793
…
1576800000000000000 0.63
1576886400000000000 2.339
This looks fine to me. Start on 8th and ends on the 21th or 22. To calculate generated power last few months I’ll make a sum of the data and group by month. Time interval is 30 days:
SELECT sum(“kWh”) FROM “file” WHERE “month”=~ /kas.lan*/ GROUP BY time(30d) FILL(null)
name: file
time sum
1570752000000000000 15.456999999999999
1573344000000000000 119.755
1575936000000000000 36.087
Here is already something strange. Epoch time is Friday, October 11, 2019 12:00:00 AM but collection hadnt even started yet. When I group by month I get this:
SELECT sum(“kWh”) FROM “file” WHERE “month”=~ /kas.lan*/ GROUP BY time(30d), “month” FILL(null)
name: file
tags: month=kas.lan-201911.csv
time sum
1570752000000000000 15.456999999999999
1573344000000000000 93.5
1575936000000000000
name: file
tags: month=kas.lan-201912.csv
time sum
1573344000000000000 26.255
1575936000000000000 36.087
3 or 2 values for one month? When making the sum it seems to be correct though… Grafana does show me the correct graph using this query:
Chronograf does also show me 3 values:
“time”,“file.sum_kWh”
“2019-10-11T00:00:00.000Z”,“15.456999999999999”
“2019-11-10T00:00:00.000Z”,“119.755”
“2019-12-10T00:00:00.000Z”,“36.087”
Anyone know why this is happening?