hi again !
Still working on my electrical dashboard, I have one more question.
I would like to rebuild something like I can see in HA electrical dashboard. where I can see the total consumption for this or that sensor, month by month.
Here is the flux query that do display the very last kWh consumtion for last month (please note I’m using 21h59 due to UTC):
from(bucket: "homeassistant")
|> range(start: 2023-03-31T21:59:00Z, stop: 2023-03-31T21:59:59Z)
|> filter(fn: (r) => r["_measurement"] == "kWh")
|> filter(fn: (r) => r["_field"] == "value")
|> filter(fn: (r) => r["domain"] == "sensor")
|> filter(fn: (r) => r["entity_id"] == "compteur_elec_conso_kwh_totale_nuit_et_jour_monthly")
|> aggregateWindow(every: inf, fn: last, createEmpty: false)
|> yield(name: "last")
Now I’d like to figure out the way to build a dashboard that would display bars, for each month of the year, where each bar would display the total kWh usage that was reported at 21h59m59s.
I was thinking about creating 12 different queries, but this makes no sense and would avoid the graph to be automatically generated.
this becomes even more impossible to manually manage if I want to display the daily usage for the whole month!
Can someone help me creating this in the right way ?
In short, this is what I’d like to see in grafana instead of HA :
each day of the month :
each month of the year:
Thanks !