boblemaire / IoTaWatt

IoTaWatt Open WiFi Electric Energy Monitor
https://iotawatt.com
GNU General Public License v3.0
639 stars 177 forks source link

API query not accruing correctly when using min/max #303

Closed PhilRW closed 3 years ago

PhilRW commented 3 years ago

I have two outputs which I use to convert net metering into two separate values: grid energy consumed and energy returned to grid. Here's an example:

net: subpanel_1 + subpanel_2 + pv grid_consumption: (( subpanel_1 + subpanel_2 + pv) max 0) abs grid_return: (( subpanel1+ subpanel_2 + pv) min 0) abs

This query http://iotawatt/query?select=[net.wh,grid_consumption.wh,grid_return.wh]&begin=d&end=s&group=all returns [[18600,18600,0]] even though the internal graph+ utility charts it properly. I would expect it to return something more along the lines of [[18600,24600,6000]]

graph+ shows it properly:

image

Glazzanz commented 3 years ago

@PhilRW agree with you, I am also having this issue.

boblemaire commented 3 years ago

As explained in this forum post https://community.iotawatt.com/t/solar-import-export/3175, the query above uses group=all, which returns the net value over the period. (Some folks who have true net metering want to know that) When graphing that function with Graph+, you are implicitly querying the net for two-minute periods.