Wrong values in hover for 'today' in 'week' and 'month' overview...
When looking at the current data from today, e. g.:
The values are in sync with what the SENEC App displays at that time, but switching to the week or month overview for today, the hover for today shows a wrong value, see:
week:
month:
This example shows the production, but it's the same for other types as well...
When using hovering past days, the values are correct.
You are right. The column in the diagram for the current day (or week/month/year) is not correct. However, this is only a temporary deviation. As soon as the day is over, it will be correct again. It's caused by the way InfluxDB handles incomplete data.
I already noticed this in the past, but I never wrote it down because the error always corrects itself. Thank you for finally doing it :-)
I'll see how I can fix that.
#1894 describes a similar problem. The reason for both issues is that the InfluxDB query used by SOLECTRUS can be inaccurate for non-closed time ranges.
Tech details: I use this aggregation code, which has great performance. But, it doesn't work right when there's not a full hour of data. I can't find a function in InfluxDB that can fix this concern.
|> aggregateWindow(every: 1h, fn: mean)
|> aggregateWindow(every: 1d, fn: sum)
I have not found a solution to this issue yet, unfortunately. As soon as InfluxDB 3.0 is available, I'll take another look at the issue.
Ursache ist, dass mit Flux die Verwendung von aggregateWindow(every: 1h, fn: mean) ungenau ist, wenn der Zeitraum noch nicht abgeschlossen ist.
Lösungsansatz:
Wenn das dargestellte Diagramm einen nicht abgeschlossenen Zeitraum betrifft (also aktuelle Woche/Monat/Jahr oder Gesamt), dann Sonderbehandlung mittels Split:
- Zunächst abgeschlossenen Zeitraum wie bisher berechnen
- Zusätzlich den laufenden (noch nicht abgeschlossenen Zeitraum) genau berechnen, über
integral(unit: 1h), mit PowerSum
Beispiel für die Berechnung des Diagramms für Juni 2024 am 14. Juni:
- Diagramm für den Zeitraum vom 1. Juni bis 13. Juni wie bisher berechnen
- Tag des 14. Juni mittels
PowerSumberechnen
Das hat auch positive Auswirkungen auf die Performance, weil die Abfragen für abgeschlossene Zeiträume im Cache landen.