# Grafana math help

I’m currently trying to get Grafana to output what is on our meter as I have to submit monthly meter readings. I currently have my total Watts, Watt hours, kilowatt hours and amps all being sent to an influxdb instance.

I also have the base number that was on the meter when the Iotawatt was connected, 45768.

Using this query gives me the proper number of kwh that has been logged by the Iota since installation and matches the energy graph in Iota’s utility so I believe it is an accurate query

SELECT integral(“value”) /3600 FROM “Total_Watts” WHERE (“iota” = ‘mudridge’) AND \$timeFilter GROUP BY time(1h) fill(null)

The problem is when I start trying to add the base 45768 to it, it always ends up displaying something like 37.x MWh which is obviously not accurate.

I believe it is due to the difference in units being measured. I’m querying watts and then trying to add kwh to it? I’m not really sure how to go about this at this point? I don’t think I can use the total kwh output as looking at the data points many intervals show 0 when there is very low usage which is often.

Grafana doesn’t do math on series. It is a visualization tool. Influxdb can do math, which is what you are doing to get energy from power. I don’t know of a way to achieve what you you want, aggregate energy usage but start at a non-zero value from some point in time.

What are you really trying to achieve?

If you want to measure the accuracy of your meter compared to IoTaWatt, just set the integral to cover the same period of time as what you have on your energy bill and do the comparison on the two deltas.

The Iota is at a remote cabin that only ever has someone at it every couple of weekends for a day or two. Recently the municipal power changed the way they estimate power usage if we don’t submit a meter reading before the 25th of the month in such a way that if we don’t send a meter reading their estimate makes the bill \$300-400 when in reality it should be \$80. Since there is hardly ever someone there that I can call and ask go read the number off the meter for me I was hoping the Iota and influx could do it for me. My goal is to constantly add 45768 kwh to whatever the current total kwh is on the Iota so I know what the reading is on the meter to submit it via the power companies website. As of right now I’m just looking at the Iota output and manually doing it with a calculator.

A separate but I imagine easier output is to have Grafana card that reads the total kwh from the 25th - 25th of each month that rolls automatically each month So we can keep track of the monthly usage but I"m not sure how to make a card that automatically rolls on the 25th.

OK, I get that you want to remotely read your meter. Couple of things:

IoTaWatt is not certified for trade. So it’s not a substitute for a physical meter reading. I expect it will track the meter pretty closely, but you are on your own if the utility challenges the data.

That said, why not just send the number you want to influx and then just read it back on the date(s) of interest? You can use the calculator to create a measurement that is `mains + 45768` settingthe unit to kWh. Query that number on the date for the 25th of the month.

Another approach is to use port forwarding to allow you to directly access the IoTaWatt and read out the kWh for the mains with an output.

I know it’s not a substitute for physical meter reading and don’t expect it to be. I just need something relatively close so that way we don’t end up with a \$400 bill that’s an estimate.

I tried doing 45768 + (main 1 + main 2) as an output to Influx with the unit as kWh but it did not appear to be working correctly? Every interval just showed 45768.0 or 45768.01? This also seemed like it would be less accurate because of periods with very low usage (many) the kWh sent to influx was 0. Am I doing something wrong with how I’m sending it?

Sorry, I misled you with that suggestion to add the kWh in the IoTaWatt and upload. The IoTaWatt is only adding the incremental kWh, hence the fractions and zeros.

This is a case where I think something like Emoncms would be easier. If you upload the power from your mains as an input, then add a process list “power to kWh” you will have a feed with cumulative kWh that you can access and plot between any dates. The statistics at the bottom of the plot will give you min, max and diff. If you use your known meter reading date as the start date and your billing date as the end date, the “diff” in statistics at the bottom should be your meter reading after you add the base reading.

The IoTaWatt Graph+ can do that as well, if you can access it remotely with port forwarding on the router. Graph+ is new, and there is a bug that I discovered trying to do this with the watt-hour plot, but it is possible using theCSV data, and I will fix the bug for the next release.

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

I tried to access the link just now from the email notification and it is not working. I’m assuming you brought the instance down?

yes. My “free” term was up and took it down.

Are you able to PM me a screenshot of your setup?