Aggregate Energy and Water data and display in various views

I have a water meter reporting data to Influxdb V2 and also an energy meter.

The water meter reports the current usage total for the day every few minutes and then resets to zero at midnight. At any time of the day, I can see how much water has been used so far for the day.

The energy meter reports the WattHours used since the unit was last reset/power cycled. It is continuously increasing.

For the water meter, I see that I can use the “increase” function to see how much water is used cumulatively over the number of days in the viewing graph window. I would like to know how I could report this data into a weekly, monthly, and year to date, and rolling year format. I have tried various methods and searches and do not understand how to manipulate the data to do this.

For the energy meter, I want to be able to show the data for usage for the day resetting at midnight, usage for the week, month, year to date, and rolling year. The WattHour data is reset to zero when the unit power cycles and I would like to be able to account for this and have the data continue to be accumulated. I have tried spread, increase, different aggregate windows, and am unable to return a daily “sawtooth” graph of usage.

Sample data is attached for both.

Energy Call

from(bucket: "sensors")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["topic"] == "sensors/power/L1/WattHour")
  |> aggregateWindow(every: 1m, fn: last, createEmpty: false)
  |> yield(name: "last")

from(bucket: "sensors")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["topic"] == "sensors/power/L1/WattHour")
  |> spread()
  |> yield(name: "spread")

from(bucket: "sensors")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["topic"] == "sensors/power/L1/WattHour")
  |> increase()
  |> yield(name: "increase")

Water meter

from(bucket: "sensors")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["topic"] == "sensors/water/today_usage")
  |> aggregateWindow(every: 1m, fn: last, createEmpty: false)
  |> yield(name: "last")

from(bucket: "sensors")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["topic"] == "sensors/water/today_usage")
  |> spread()
  |> yield(name: "spread")

from(bucket: "sensors")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["topic"] == "sensors/water/today_usage")
  |> increase()
  |> yield(name: "increase")

Water data

#group	FALSE	FALSE	TRUE	TRUE	FALSE	FALSE	TRUE	TRUE	TRUE	TRUE
#datatype	string	long	dateTime:RFC3339	dateTime:RFC3339	dateTime:RFC3339	double	string	string	string	string
#default	last									
	result	table	_start	_stop	_time	_value	_field	_measurement	host	topic
		
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T00:30:00Z	210.7	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T01:00:00Z	210.7	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T01:30:00Z	210.7	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T02:00:00Z	210.7	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T02:30:00Z	210.7	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T03:00:00Z	211.4	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T03:30:00Z	229.4	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T04:00:00Z	231.4	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T04:30:00Z	250.1	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T05:00:00Z	268.1	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T05:30:00Z	272.3	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T06:00:00Z	275.6	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T06:30:00Z	276.4	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T07:00:00Z	276.4	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T07:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T08:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T08:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T09:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T09:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T10:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T10:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T11:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T11:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T12:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T12:30:00Z	0.4	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T13:00:00Z	0.4	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T13:30:00Z	0.4	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T14:00:00Z	1.4	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T14:30:00Z	1.4	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T15:00:00Z	10.7	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T15:30:00Z	24	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T16:00:00Z	194.2	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T16:30:00Z	391.4	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T17:00:00Z	391.4	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T17:30:00Z	391.4	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T18:00:00Z	391.4	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T18:30:00Z	391.4	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T19:00:00Z	391.7	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T19:30:00Z	391.7	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T20:00:00Z	391.7	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T20:30:00Z	391.7	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T21:00:00Z	391.7	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T21:30:00Z	391.7	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T22:00:00Z	391.7	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T22:30:00Z	391.7	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T23:00:00Z	391.7	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-07T23:30:00Z	391.7	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-08T00:00:00Z	393	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-08T00:30:00Z	393	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-08T01:00:00Z	393.5	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-08T01:30:00Z	393.8	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-08T02:00:00Z	394.5	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-08T02:30:00Z	394.8	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	2022-05-08T03:00:00Z	395.8	value	mqtt_consumer	3e1f8fb4609f	sensors/water/today_usage
		0	2022-05-03T17:28:23.580786Z	2022-05-10T17:28:23.580786Z	

Energy Data

#group	FALSE	FALSE	TRUE	TRUE	FALSE	FALSE	TRUE	TRUE	TRUE	TRUE
#datatype	string	long	dateTime:RFC3339	dateTime:RFC3339	dateTime:RFC3339	double	string	string	string	string
#default	last									
	result	table	_start	_stop	_time	_value	_field	_measurement	host	topic
		
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-07T05:00:00Z	1050	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-08T16:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-08T17:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-08T17:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-08T18:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-08T18:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-08T19:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-08T19:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-08T20:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-08T20:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-08T21:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-08T21:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-08T22:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-08T22:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-08T23:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-08T23:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T00:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T00:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T01:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T01:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T02:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T02:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T03:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T03:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T04:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T04:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T05:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T05:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T06:00:00Z	-1	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T06:30:00Z	-1	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T07:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T07:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T08:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T08:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T09:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T09:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T10:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T10:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T11:00:00Z	-1	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T11:30:00Z	-1	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T12:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T12:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T13:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T13:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T14:00:00Z	-1	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T14:30:00Z	-1	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T15:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T15:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T16:00:00Z	-1	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T16:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T17:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T17:30:00Z	181	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T18:00:00Z	188	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T18:30:00Z	188	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T19:00:00Z	188	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T19:30:00Z	726	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T20:00:00Z	1269	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T20:30:00Z	1814	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T21:00:00Z	2240	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T21:30:00Z	2240	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T22:00:00Z	2240	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T22:30:00Z	2239	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T23:00:00Z	2239	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-09T23:30:00Z	2239	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T00:00:00Z	2238	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T00:30:00Z	2238	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T01:00:00Z	2237	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T01:30:00Z	2237	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T02:00:00Z	2236	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T02:30:00Z	2236	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T03:00:00Z	2235	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T03:30:00Z	2235	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T04:00:00Z	2234	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T04:30:00Z	2234	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T05:00:00Z	2233	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T05:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T06:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T06:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T07:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T07:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T08:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T08:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T09:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T09:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T10:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T10:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T11:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T11:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T12:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T12:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T13:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T13:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T14:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T14:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T15:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T15:30:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T16:00:00Z	0	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T16:30:00Z	102	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T17:00:00Z	405	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour
		0	2022-05-03T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	2022-05-10T17:28:55.672559165Z	697	value	mqtt_consumer	3e1f8fb4609f	sensors/power/L1/WattHour

for water data 1d, 1w,1mo, 1y data you can use window() function, and based on that you can perform the operation.

for energy data, I am not able to understand the what is the output you are expecting.
can you explain a little bit more about energy data with the correct output that you expect?

The energy data is being stored as a total WattHour since the unit was powered on. If I want daily usage, each day should start at zero and accumulate until midnight and reset again. The reset should remove the previously accumulated energy from all measurements for the day. The graph should be a sawtooth pattern for each day. If the data can be configured this way, then I assume it could be shown in weekly, monthly, annual graphs as well