Problem with influxdb and energy-monitor

I use an energy-counter with a S0-Puls-Output and write the steady increasing counter value [W] (labeled as S01) and the timestamp (labeled as time) in a influx database (measurement N046GA_1) every 60s. In Grafana I have a query and I want to calculate the energy-consumption of today and I get 45.4kWh, this is too much. Wenn I show the S01 values at influx, the difference between now and 00:00 is 23.1kWh. What can I do?
Thanks for all !


.

I use an energy-counter with a S0-Puls-Output and write the steady
increasing counter value [W] (labeled as S01) and the timestamp (labeled
as time) in a influx database (measurement N046GA_1) every 60s. In Grafana
I have a query

What is that query?

and I want to calculate the energy-consumption of today and I get 45.4kWh,
this is too much. Wenn I show the S01 values at influx, the difference between
now and 00:00 is 23.1kWh.

Show us how you get that number.

What can I do?

Please provide enough information that we can understand what you are doing
and where the problem might be.

For now, all anyone can really say is “there’s an error in your query”, but
that’s not very helpful…

Regards,

Antony.

sorry, hope the image with the query is now visible.

this is the query string:

SELECT non_negative_difference(mean(“S01”)) FROM “N046GA_1” WHERE $timeFilter GROUP BY time(1d) fill(null)

Hi,
I dont undertand your idea of using mean inside of non_negative_difference.
You could try this:

SELECT SPREAD(“S01”)
FROM “N046GA_1”
WHERE $timeFilter
GROUP BY time(1d) fill(null)

Thanks a lot, it works great for the html selected timerange “today”, “yesterday”", but not for “last 2 days”.
I made some datapoints for my test:

select * from S0
name: S0
time value


2020-02-15T00:00:00Z 0
2020-02-15T03:00:00Z 1
2020-02-15T06:00:00Z 2
2020-02-15T09:00:00Z 3
2020-02-15T12:00:00Z 4
2020-02-15T15:00:00Z 5
2020-02-15T18:00:00Z 6
2020-02-15T21:00:00Z 7
2020-02-16T00:00:00Z 8
2020-02-16T03:00:00Z 9
2020-02-16T06:00:00Z 10
2020-02-16T09:00:00Z 11
2020-02-16T12:00:00Z 12
2020-02-16T15:00:00Z 13
2020-02-16T18:00:00Z 14
2020-02-16T21:00:00Z 15
2020-02-17T00:00:00Z 16
2020-02-17T03:00:00Z 17
2020-02-17T06:00:00Z 18

For “Last 2 days” i get S0.spread 2, but I expected 15.

Any suggestion, please?

try this:

SELECT SPREAD(“S01”)
FROM “N046GA_1”
WHERE $timeFilter
fill(null)

Wow, this works like a charm!
Many, many thanks!!

1 Like

Building on this, is it possible to get the spread for each of the entries based on the time interval?

I have the same as Difference of min and max over $__interval but I would like to the values based on the interval

SELECT spread("value") FROM "autogen"."kWh" WHERE ("entity_id" = 'energie_gebruikt_t1') AND $timeFilter gives me only the a single value.