Error "unknown import path: 'timezone'" when using timezone with flux on influxDB in grafana (HomeAssistant)

Hi all,

I am quite new to using grafana but could already solved some issues also with this great forum. But for the current problem I cannot find a solution so far.
I am using HomeAssistant (latest version) in a synology virtual machine.
I have installed the HA-AddOns InfluxDB (version 5.0.0) and grafana (version 9.2.2).

In grafana I already created a complete dashboard for my photovoltaic system showing the data on a daily data base. I made this using influxql.
Because influxql does not support gouping by month, I change over to using flux.
My InfluxDB saves data in UTC, so I have to use timezone to get correct data.

But when I try to use timezone in grafana I get the following error:
500 Internal Server Error: type error 1:1-1:18: unknown import path: “timezone”

My flux query:

import "timezone"
option location = timezone.location(name: "Europe/Berlin")

from(bucket: "hoas_ifxdb/RETPOL_FIVEMIN_INFINITE")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r._measurement == "W"
      and r.entity_id == "inverter_eingangsleistung")
  |> filter(fn: (r) => r["_field"] == "mean_value")
  |> yield(name: "PV-Ausgang")

If I remove the first two lines (import … + option …) the query works and returns data (but for the wrong time range - offset of UTC to local time).

I’m grateful for any help.

Welcome @kaink1607

I saw a similar question where the user was using HA and installed InfluxDB v 5.0.0. which is some crazy versioning system used by HA, not by InfluxDB, and which apparently corresponds to an older version of InfluxDB like 1.8 or 2.0. The timezone package is likely not supported on such an old version of InfluxDB.

Thanks for your feedback.
Does this mean with the HomeAssistant AddOn there is no possibility to use timezone with Flux?
Is there another way to get data for local time for a month?

Is there maybe another way to get data for a complete month in grafana (group by day)?