InfluxDB - calculating total import/output $ values?

Hi All,

Apologies if this has been covered, I’ve looked high and low.

I have my IoTaWatt setup working well, outputting to emoncms, pvoutput and a local instance of influxdb. I’m looking to get $$$ values of out what I import and export.
So for anything I import it should be $0.40 per kWh, anything I export is $0.20 per kWh
I was hoping to set up an influxdb output where I get my import kWh and just multiply it by $0.40, set the unit as currency and away we go, but I cannot figure it out. I reckon I’m overthinking it, but there’s a decent chance that I’m a dumbarse and have overlooked the obvious.

Export output looks like this:
Watts = ((mains abs + mains) ÷ 2) - main

Import like this:
Watts = (mains abs + mains) ÷ 2

Ideally I’d like a way to present this in grafana so that I have a singlestat of what was imported/exported on a day. Once that’s done, there’s no reason I can’t have a day/week/3month/12 month graph of it all.

Can provide screenshots of outputs if relevant, please let me know.

HHave you looked at the tariff capabilities in PVoutput? I haven’t used them myself, but it looks like you can do a lot with that and report out $$$ nicely.

If you want to do it in influx/grafana, my instinct is to do it by multiplying by the rate in the grafana query.

Btw/ those functions for import/export can now be simplified with the new min/max functions in the IoTaWatt calculator:

Export = mains min 0. (Export is a negative value)

Export =(mains min 0) abs (Export is a positive value)

Import = mains max 0

Thanks @overeasy, I’ll simplify those when I get a chance.

Yep, currently using the tariffs in PVOutput, was hoping to knock something together with my local influxdb instance.

I tried to do the multiplication but it just freaked out. Some of my panels already have math in them (to get the day plotted out). I’ll keep looking.

Hope I can help,
i currently do this using influx db, this is my singlestat for Exported Power:
This is the calculation:

My export tarriff is 11.3 cents (0.113 in the calculation)
On the options tab, set the STAT to total:

This works for me and calculated the same as PVoutput.
The setting in iotawatt for output to influx db is below:
52 46

I have 2 single stats showing imported and exported based on the above outputs from iotawatt.

Hope this helps.

1 Like

Yep that’s done it, thanks heaps, much appreciated :slight_smile:

Now to work out how to do today/yesterday totals ignoring the time/date selector in the top right.

Try this for yesterday

1 Like

And try this for today

1 Like

Yep that’s spot on, yesterday matches yesterday, thanks heaps :slight_smile: