I’m 98% sure this is completely my lack of knowledge and understanding, but I need some assistance in fine tuning/correcting my Influx query. I am running Grafana 11.2.3 and Influx 2.7.11. With SunPower’s bankruptcy and SunStrong’s recent announcement of charging for the historical data, I started exporting my HomeAssistant Solar and Energy data into Influx. My hourly views are spot on, but my daily views are showing two columns for the current day and I can’t figure out why.
My query:
import "timezone"
option location = timezone.location(name: "America/Los_Angeles")
from(bucket: "home-assistant")
|> range(start: -7d, stop: now())
|> filter(fn: (r) => r["_measurement"] == "W")
|> filter(fn: (r) => r["entity_id"] == "solar_power_total")
|> filter(fn: (r) => r["_field"] == "value")
|> map(fn: (r) => ({ r with _value: r._value / 1000.0 }))
|> aggregateWindow (every: 1h, fn: mean, createEmpty: false)
|> truncateTimeColumn(unit: 1h)
|> aggregateWindow (every: 1d, fn: sum, createEmpty: true)
My thoughts/logic on this query is that I pull the values from each hour throughout the day and add it all up to give me a total for that day.
My Grafana view:
As you can see in the bottom right, I have two columns for today, 3/20. The far right column looks like it is today so far, but I’m not sure how/where the next column over is getting its data from. My guess is the last 24 hours from that point backwards.
Is there something I am querying wrong? Or just a limitation of Influx/Grafana? Again, I am very new to this and learned a lot along the way, but I’m stumped at the moment.
6 posts - 2 participants