Twonky
Twonky

Reputation: 806

Understand daily energy consumption distribution with Flux from InfluxDB

Has been asked here and there, without properly working solution: How to plot data to understand the energy consumption over an average day?

I could then understand at which daytimes I need what amount of energy. With this information, I could consider the placement of solar panels.

Energy consumption goes into InfluxDB. A brief query

from(bucket: "Energie")
  |> range(start: -7d)
  |> filter(fn: (r) => r["_measurement"] == "mqtt_consumer")
  |> filter(fn: (r) => r["topic"] == "energie/haushalt_hm/IEC_POWER")
  |> aggregateWindow(every: 5m, fn: mean, createEmpty: false)
  |> keep(columns: ["_value","_time"])

returns data as expexted (:

table _value _time
0 0 2025-02-01T12:45:14.961Z
0 1139 2025-02-01T12:50:13.324Z
...
0 1224 2025-02-08T10:49:34.815Z

Now, I would love to plot the average/median (later, maybe min/max) of each aggregated bin (5 minutes) of all days' bins. Means, data points for Mondays 0:00-0:05, Mondays 0:05-0:10 ... Sundays 23:50-23:59. I would expect a table with 288 rows (60mins * 24hrs / 5mins).

Upvotes: 0

Views: 14

Answers (0)

Related Questions