I am quite new to InfluxDB, ran across it, when we got our new PV system from Victron and I learnt about the power of Nodered.
So storing all the metering information works fine. The PV system sends to the power Info in Watt every 10 seconds.
Now I want to calculate the produced energy in Wh for every hour and this is where I currently fail.
I created a task that is run 1 minute past the hour every hour. I truncate the start and stoptime to the full hour and Substrat 1 hour each to only deal with the last full hour.
problem that I have is, that when summing the 10secs values, I get the double amount of lines (720 instead of 360). I can deal with that dividing the total amount by 720 instead of the correct 360 count, but still strange. I am using every 1h aggregation when summing up.
my bigger problem is the time stamp of the resulting set. I want to have the aggergates 1h into the future, so all generations between 7:00 and 7:59 shall be at the 8:00 timestamp. I tried using offset:1h to achieve this.
What I don‘t understand is the displaying of result sets in InfluxDB. When I try to query the result set and set the aggregation window to 5secs, I get all timestamps 5 secs after the hour. When I set it to 1 hour I get all timestamps shifted to the next hour. How can I validate, the timestamp was set correctly?
The script works for me now and i actually also found the reason for the 720 data points. There are data points every 5 seconds, that sums up to 720 per hour.
The influxDB querybuilder got me confused because the lowest aggregation window solution there is 10 seconds. When switching to script editor and eliminating the aggregation window clause I can now see al the data points.