Power consumption per day


I got a problem with displaying my power consumption per day and I am pretty sure that someone here can point me in the right direction.

I am using a table with some overrides for a better representation of the data. For the data itself I use the aggregateWindow Function for one day (1d) and only take the last value. To get the consumption per day the difference function is used which subtracts the value from the day before.

For the representation I override the value field with gradient gauge display mode and the time field with display name “Tag” (= day) and a custom unit time:DD.MM. for the date.

I have two problems that I don’t know a solution for. First one is obvious: The actual date is shown twice. In the picture the 27th is in the first and second row and I don’t know how to change that. It would also be nicer to name the first one “today” but that is something different.

Second problem is that the first row doesn’t show the actual consumption. There is a value of 1.45 but the graph is equal to zero and also the value of 1.45 doesn’t change over the day. Normally it should grow because I am consuming power.

Any ideas what I can do?

Thank you very much.

My code:

import “timezone”
option location = timezone.location(name: “Europe/Berlin”)

from(bucket: “iobroker”)
|> range(start: -7d, stop: now())
|> filter(fn: (r) => r[“_measurement”] == “sonoff.0.Stromzaehler.SENSOR.Z1.Bezug_1_8_0”)
|> filter(fn: (r) => r[“_field”] == “value”)
|> aggregateWindow(every: 1d, fn: last, createEmpty: false)
|> difference()
|> yield(name: “last”)

welcome to the :grafana: forum, @frank101

looks like you’re using influx2 with the new flux language. There are a TON of power-consumption-per-day topics on this forum. I would do a search over the past few years. There are lots of sample queries on good threads with input some very good influx users. They are all a little different depending on the flavor of your setup and desired outcome, but I bet you’ll find some useful stuff if you go digging :+1: