Negative solar after dark

New to iotawatt and love it.

Using Grafana dashboards to display.

Overnight my solar will show -5w,which is correct as the inverter states it will use 5w in standby, and iotwatt shows the same.

So while minuscule, this 5w shows as a difference between my grid use now, and import value (Using for example shows 268W, import shows 273W which is true as the 5w is being removed from my usage value from the iotawatt)

So my kWh calculation on use is not correct overnight.

Is there a way or a feature request for a tickbox in iotwatt for if the solar shows a negative value, make it show and upload “0” so the calculations are correct?

I have purposely ticked negative flow on solar so it shows as -, otherwise it reports positive 5w and changes the import and usage the other way around.


I believe there is an “Allow Negative Values” checkbox when you setup the input.


It is unchecked by default. How is your input configured?

If you’re making up your own output by subtracting inputs from one another, that can cause negative values (unless you use the ABS feature).

1 Like

There is a convoluted way to do that with the calculator:

(solar abs + solar) / 2

Thanks @overeasy , I’ll try that.

So I have done ((solar abs + solar)/2)+mains

And house use now is within 1 watt of the mains ( solar set allow negative, and mains set allow negative)

Solar is using at the moment -5 watts (dark now in Australia…) but my mains and calculated output houseuse2 are within 1 watt

So I think this will work.

May have some questions later about kWh display in Grafana from influxdb but still playing.


Changed it to (solar abs + solar)/2+mains with out the second set of brackets and it’s matches exactly now with my current mains import.


It’s just rounding. One Watt in that range is pushing the envelope. Is this a three-phase install?

I have been told by a reliable source that integrating energy from a power dataset that has negative values doesn’t work properly in influxDB. I’ll be curious to see what you find. You can always send Wh to influx to keep track of energy.

Single phase. Yes I don’t think Grafana likes negatives when working out kWh using intergral to find the kWh, even when I’m telling it to ignore negative values.

Starting to play with sending kWh to it from iotawatt. Waiting for some real data to get in there before I can see if it’s correct. My power company each night uploads yesterday’s data. My Solar generated is within half a kWh (which when I’m exporting 30kwh hours is pretty accurate) but my import on Grafana is about 2kwh above what I have really bought in.

On Grafana I can record my house use kwh accuratly as this is positive, generation is accurate as it’s positive, but import is not accurate like you said most likely because of negative values. I’m going to try an influx continuous query to try and make any negative data be replaced with zero on a new field.

There is an influx forum. If you find out anything, inquiring minds want to know…

Starting to dig into it. I’ve just tried similar theory on the outputs using the calc on my mains ct of (mains abs + mains)/2

Currently I’m exporting and this calculation (import_test) is now showing 0, and not negative -2000 as I’m currently exporting 2kw. Mains is showing -2000.

Just turned the solar off, mains went to +500, and the test calculation import_test also went from 0 to +500 so I think using this in Grafana solves the problem as there won’t be any negative values on my import calculation now.

Saves having to work out a continuous query and having this hidden in influx dB where I would forget about it sitting there, I wanted to stay away from hidden calculations.

That’s what the other guy did. That function in the calculator is not easy to follow. I do plan to add min and max functions so you could code it:

(0 MAX mains) to get only positive :: same as (mains + mains ABS) / 2
(0 MIN mains) to get only negative -> same as (mains - mains ABS) / 2

That would work well. Cheers.

So have changed my calcualtions so that nothing is ever negative, other than my mains.

Solar_Generating is always positive or 0. (but relies on allow negative flow being ticked on the input setup)
Import is always positive or 0, and is only a positive number when importing
Export is always positive or 0 and is only a positive number when exporting

My calculations are shown in the screen shots.

now my house use, solar generations, export and import figures are all adding up the way they should. kwH all seem accurate, but will need a couple days of data to compare to my suppliers metering.

Thanks for the help.


Calculated Status Outputs:

1 Like

Thanks for this topic, it was really helpful when I had the same issue with my Fronius inverter.

I noticed that the min and max functions appear to be implemented now, so I’m posting an updated screenshot on how I’ve configured my system with 2 inverters and net metered mains, in case it’s useful to anyone else.

1 Like