Newbie Question about values in InfluxDB vs values in HA

Hello,
Some weeks ago, I set up InfluxDB to monitor my solar panels over a longer time.
I have not done much yet with influxDB/Grafana, just created one graph.

This is the config, i wanted to start with one sensor only:

> influxdb:
>   host: 192.168.1.99
>   port: 8086
>   database: homeassistant
>   username: user
>   password: password
>   ssl: false
>   verify_ssl: false
>   max_retries: 3
>   default_measurement: state
>   include:
>     entities:
>        - sensor.pv_strom_gesamt

And this is the query in Grafana. Just selected the sensor from the gui

SELECT mean("value") FROM "autogen"."Watt" WHERE ("entity_id" = 'pv_strom_gesamt') AND $timeFilter GROUP BY time($__interval) fill(null)

Now this is what I get: 1st picture is a lovelace sensor card, 2nd is a Grafana Graph.
We are looking at last Sunday, the 26th. Why is the “Max” Value in the Lovelace card another than the one in the Grafana chart? Is there something missing in the config or the query?

ha

Thanks for any comment on this
Philipp

It depends on what the HA graph does exactly, but would say it is because of the fact that you are using mean. Grafana is showing you the highest mean value, not the maximum of all the values. Unless the maximum is attained for a long time, the mean value will always be lower than the maximum.

Use ‘last’ instead of ‘mean’

Thanks a lot, that looks better.
I know I have to read some docs by myself, but is it (easily) possible to put the date behind the max value in the legend, when the value occured?