Closed cypherstream closed 2 years ago
I no longer have a version prior to Influxdb2 to test with, so this will only be a guess. The way you're aggregating your consumption is going to differ with time intervals. Here is an example of a better way to do it, though it uses flux, so will require some grokking on your part.
from(bucket: "7d")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "utilities")
|> filter(fn: (r) => r["msg_type"] == "differential")
|> filter(fn: (r) => r["_field"] == "consumption")
|> aggregateWindow(every: 15m, fn: sum, createEmpty: true)
|> map(fn: (r) => ({r with _field: "Power"}))
|> drop(columns: ["endpoint_id", "endpoint_type", "msg_type", "protocol"])
Closing due to age.
First of all, awesome program! I already have a grafana setup and InfluxDB instance monitoring my home networking. I've been eyeing up a flume 2 water meter add on but it's over $200. For just the SDR I can accomplish the same thing.
The one thing I'm not so sure about is the scaling in grafana. If I'm zoomed in at 20:50 I see a spike of 150 gallons used. If I'm zoomed out to 3 hour window it looks like 450 gallons used.
It's set to difference. Should I be setting it to something else?
As far as the units... I'm not sure they are right or if I need to divide by 10 for example. At some point I'll fill up a 5 gallon bucket and see if it actually registers as 5.