Influxdb 2 and Iotawatt

Im considering getting a solar battery and was going over some of my data.
Upon reviewing, it seems data in influx is not macthing that of iotawatt and want to ask if my flux query is correct??
Flux query:
from(bucket: “iotawatt”)
|> range(start: today())
|> filter(fn: (r) => r._measurement == “consumption” and r._field == “watts”)
|> aggregateWindow(every: 10s, fn: mean, createEmpty: false)
|> integral(unit: 1s)
|> map(fn: (r) => ({ r with _value: r._value / 3600000.0 }))
|> sum(column: “_value”)

This returns 30.10, whilst graph+ has 47.4

What am i missing?
Cheers

Doing flux makes my head hurt. Any flux proficient users out there that can help with this?

What time zone is your InfluxDB using?

Just because you are using 2.0 doesn’t mean you HAVE to use Flux. I use Flux when I need to aggregate multiple channels, otherwise I just use IQL.

You can set the time zone in the query to make sure.

This is a query that gets the daily energy usage of my water heater for use with Grafana.

SELECT integral("Watts")  / 1000/60/30 FROM "iotawatt" WHERE ("channel" = 'HPWH_A') AND $timeFilter GROUP BY time(1d) fill(null) tz('America/Vancouver')

This query works well enough for me, but it is an expensive query since it has to integrate across all of the data points. Doing it for 3 months takes a few seconds (every time I display the graph). I really should be running queries to do that automatically to make it easier/quicker to graph.

I am not sure how to set time zone for flux, but this might help.

Thanks for the documentation.

Timezone was the issue
Added this to the start

import "timezone"
option location = timezone.location(name: "Australia/Sydney")

And now data matches

Thanks to you both

On a side note, @overeasy are you planning to add Influxdb3-core when released?