Hassle with aggregation over time in Grafana and/or InfluxDB 2

Hi. I’m new in Grafana & Influx, so sorry for stupid questions. And I’m not even sure if the solution is to find in Grafana or Influx.

I store the energy consumption in kWh for different devices per hour in InfluxDB. That means at the end of each hour the value for the last hour is calculated and written. Due to the processing time of the script the timestamp (_time) is about 5 seconds in the following hour. Also, the timestamp is at -1 hour against my local timezone. I suspect this is due to the storage in Zulu time in Influx. Here is the raw data on an example:

Please see next post because of media limitation of new community user

If I draw a Time series in Grafana with this raw data - without aggregation over time - everything looks fine. The points of the bars are on the time markers of the X-axis:

Now I would like to show the totals per day and supplement the Flux query with an aggregateWindow function. In Influx the first problem occurs now. For the current day I get two entries:

Please see next post because of media limitation of new community user

And in Grafana it looks like this. Besides the problem with the two records for the current day, the data is displayed with +1 hour:

I think it is due to the issue described at the beginning, that the data of the last hour is written in the new hour.

Do I have the possibility to manipulate this via the Flux query and/or in Grafana to show the desired result, or do I have to write my data at 23:59:59 in the future instead of 00:00:05? If so, there is the question of adjusting the old data, but that is probably something for the Influx forum.

Thanks in advance.

Frank

Here are the raw data in Influx

and with aggregation

Frank