When using a battery in conjunction with a solar PV system, it is possible for exports to greatly exceed generation, when, for example, the battery is discharged to the grid to take advantage of a high Feed In Tariff
If you edit an output and try and enter a value for Exports that exceeds Generation, you get an error message: Energy exported cannot exceed energy generated by 1000W
However, when you use the API, it just fails silently. e.g.
# curl -H "X-Pvoutput-Apikey: $KEY" -H "X-Pvoutput-SystemId: 93768" "https://pvoutput.org/service/r2/getoutput.jsp?df=20251103&dt=20251103"
20251103,6956,0.798,0,12139,2539,17:30,Cloudy,13,22,NaN,NaN,NaN,NaN#
# curl -d "d=20251103" -d "e=9510" -d "pp=3068" -d "pt=17:23" -d "ip=1511" -H "X-Pvoutput-Apikey: $KEY" -H "X-Pvoutput-SystemId: 93768" "https://pvoutput.org/service/r2/addoutput.jsp"
OK 200: Added Output#
# curl -H "X-Pvoutput-Apikey: $KEY" -H "X-Pvoutput-SystemId: 93768" "https://pvoutput.org/service/r2/getoutput.jsp?df=20251103&dt=20251103"
20251103,6956,0.798,0,12139,2539,17:30,Cloudy,13,22,NaN,NaN,NaN,NaN#
The update responded with OK, but the output record has not been updated.
There are two issues:
- The API should not fail silently on an error.
- Validation needs to take battery storage into account. Maybe the validation should be something like consumption + exports cannot exceed generation + imports.