Different data result in influxDB2 between python import and flux task

I get the following result for my smartmeter data in influxDB2:

The data shown as one record was imported with a python script, the data imported with the two records per day is imported with a flux script. The data is generated with a smartmeter and transferred to my Smarthome system from where I transfer the fields DayDatum, DayMesswert, and DayKWH at midnight (00:00:00 Austria time) to InfluxDB2. The flux script run at 03:00.

Python script:

import csv
from influxdb_client import InfluxDBClient, Point, WritePrecision
from influxdb_client.client.write_api import SYNCHRONOUS
from time import sleep

token = ‘xxxxx’
org = ‘HomeLab’
bucket = ‘Versorgung’
url = ‘http://10.49.101.30:8086

client = InfluxDBClient(url=url, token=token)
write_api = client.write_api(write_options=SYNCHRONOUS)
with open(‘data3.csv’, mode=‘r’) as file:
csv_reader = csv.DictReader(file,delimiter=‘;’)
for row in csv_reader:
# Create a point and write it to InfluxDB
point = Point(“Strom”)
.tag(“Datum”, row[“Datum”])
.field(“Messwert”, float(row[“Messwert”]))
.field(“kWh”, float(row[“kWh”]))
.time(row[“timestamp”])
write_api.write(bucket=bucket, org=org, record=point)
print(“Data written to InfluxDB successfully!”)
client.close()

The CSV which is imported by the python script

timestamp,Datum,Messwert,kWh
2024-11-08;2024-11-07;9353.686;12.940
2024-11-09;2024-11-08;9368.013;14.327
2024-11-10;2024-11-09;9381.688;13.675
2024-11-11;2024-11-10;9395.596;13.908

Flux task which writes the latest records

option task = {name: “StromTagesimport1”, cron: “0 3 * * *”, offset: 20m}

// Query the last record from the first measurement
data1 =
from(bucket: “Versorgung”)
|> range(start: -18h)
|> filter(fn: (r) => r._measurement == “DayDatum” and r._field == “value”)
|> last()
|> findRecord(fn: (key) => true, idx: 0)

// Store the value in a variable
xxx = data1._value

// Query the last record from the second measurement
data2 =
from(bucket: “Versorgung”)
|> range(start: -18h)
|> filter(fn: (r) => r._measurement == “DayMesswert”)
|> last()
|> map(fn: (r) => ({_time: r._time, _field: “Messwert”, _value: r._value, Datum: xxx}))
|> set(key: “_measurement”, value: “Strom”)
|> to(bucket: “Versorgung”)

// Query the last record from the third measurement
data3 =
from(bucket: “Versorgung”)
|> range(start: -18h)
|> filter(fn: (r) => r._measurement == “DayKWH”)
|> last()
|> map(fn: (r) => ({_time: r._time, _field: “kWh”, _value: r._value, Datum: xxx}))
|> set(key: “_measurement”, value: “Strom”)
|> to(bucket: “Versorgung”)

The imported records of the Flux script show in 2d period timestamp “…T23:10:00 UTC”


… and in 7d period timestamp “…T23:30:00 UTC”

Any idea how to solve the problem? Is the problem the wrong timestamp or is the problem the record structure?

I soved the problem: The data is generated by my smartmeter and transferred to my Smarthome system. The Smarthome system generate the end of day data at midnight (00:00:00 Austria time) but transfer the fields DayDatum, DayMesswert, and DayKWH to InfluxDB2 two hours later which is “01:00:00 UTC” in winter and “02:00:00 UTC” in summer.