How to graph data where the difference between timestamps is the data?

I recently set up a software defined radio to read my house power meter and store it in InfluxDB, and would like to visualize this consumption in Grafana. The organization of this data has me stumped how to do this - the consumption data is an integer number of kilowatt hours and I get a new record in Influx only when that value changes. So when rate of consumption is (change in kilowatt hours)/(change in time) in this case the (change in kilowatt hours) is always 1 and the (change in time) might be 20 minutes to an hour - the time interval between measurements is irregular.

So for starters I’d like Grafana to graph the most recent rate of consumption which is 1/(time of most recent entry - time of second most recent entry). Then I’d like to graph the historical rate of consumption.

Any clues on how to do this? If I just sample the current integer consumption value several times an hour I’m not going to get a useful value.

Hi @sprior,

That’s an interesting question. Have you made any progress on this? If not, could you share what data looks like in Influx and what grafana version you’re running?

Thanks!
~matt

Unfortunately I haven’t made any progress on this yet and would be happy to share what the data looks like in influx. Here are some sample records:
1620967299362036049 75964
1620969104353745120 75965
1620972238474610837 75966
1620975695002920378 75967
1620979290083162591 75968
1620982562521915930 75969
1620985878234034832 75970
1620989268276190891 75971

The first column is the timestamp and the second column is the new cumulative value on the power meter. So the point of my question is that the actual value for the cumulative power meter isn’t interesting, it’s simply always the previous value incremented by one. The real data here is the amount of time it took for the power value to increment by one which happens two or three times per hour which means the samples are inconsistently spaced but still represent kwh/time. I’d like the Grafana output to show that for the time between the samples I was using X kwh/hour.

I’m currently using Grafana 7.5.1 but could upgrade to 7.5.X trivially if it would help.

ok, so first thing: have you managed to configure the InfluxDB datasource in Grafana and get your data into the app? Can you write any queries and visualize your data “as is” in Grafana, or are you not at that stage yet?

Yes (BTW I’ve configured Grafana for other things so I’m able to do basic config). I’ve got a data source called InfluxDB-utilities) and can display something (not what I want) with the query:
FROM autogen power WHERE
SELECT field(consumption)
GROUP BY
FORMAT AS Time Series

I was just able to produce this using:
FROM autogen power WHERE
field(consumption) derivative(1h)
GROUP BY
FORMAT AS Time series

But it’s been a LONG time since I took calculus so I’m not totally sure this is what I think it is and how the 1h fits into it.

1 Like

You might want to do some testing with Influxv2 and FLUX. I use an available function “elapsed()” to plot the time difference between event timestamps.

2 Likes

This topic was automatically closed after 365 days. New replies are no longer allowed.