Optimizer: publish result before status check (#32055)
This commit is contained in:
parent
1db0d5015c
commit
19c4e06391
1 changed files with 6 additions and 4 deletions
|
|
@ -551,10 +551,8 @@ func (site *Site) optimizerUpdate(battery []types.Measurement) error {
|
|||
return apiError(resp)
|
||||
}
|
||||
|
||||
if resp.JSON200.Status != optimizer.Optimal {
|
||||
return errors.New(string(resp.JSON200.Status))
|
||||
}
|
||||
|
||||
// publish before the status check so the optimizer page stays available
|
||||
// for diagnosing non-optimal results
|
||||
site.publish("evopt", optimizerResult{
|
||||
Updated: time.Now(),
|
||||
Req: req,
|
||||
|
|
@ -562,6 +560,10 @@ func (site *Site) optimizerUpdate(battery []types.Measurement) error {
|
|||
Details: details,
|
||||
})
|
||||
|
||||
if resp.JSON200.Status != optimizer.Optimal {
|
||||
return errors.New(string(resp.JSON200.Status))
|
||||
}
|
||||
|
||||
slotHours := firstSlotDuration.Hours()
|
||||
gridImporting := len(resp.JSON200.GridImport) > 0 && resp.JSON200.GridImport[0] > 0
|
||||
gridExporting := len(resp.JSON200.GridExport) > 0 && resp.JSON200.GridExport[0] > 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue