batpred
batpred copied to clipboard
Direct Octopus errors
Describe the bug
- Appears to try and join saving sessions multiple times
- Exception 700 raised during rate imports
- Octopus API responds with bad gateway 502
Expected behaviour
- Expect to join the saving session once 2 & 3) Handle the failure of retrieving Octopus Import/export rates gracefully if not available
Predbat version
v8.16.0
Environment details
- AC3.0
- Standard HAOS installer
Log file
Saving session error:
025-03-05 11:45:15.574122: Warn: Octopus API: Errors in request (https://api.octopus.energy/v1/graphql/): [{'message': 'Account ineligible to join Saving Sessions event.', 'locations': [{'line': 2, 'column': 2}], 'path': ['joinSavingSessionsEvent'], 'extensions': {'errorType': 'VALIDATION', 'errorCode': 'KT-GB-5117', 'errorDescription': 'Account does not meet all criteria required to join Saving Sessions event.', 'reason': 'Account is already signed up to this event and cannot join again.'}}]
Exception 700: `2025-03-05 11:35:13.818009: PV Forecast 26.3 kWh and 10% Forecast 16.7 kWh pv cloud factor 0.2 2025-03-05 11:35:13.828056: Load divergence over 8.0 hours mean 772.5 W, min 0.0 W, max 2719.2 W, std dev 637.84 W, divergence 41.28% 2025-03-05 11:35:13.860741: Error: Exception raised 700 2025-03-05 11:35:13.861343: Error: Traceback (most recent call last): File "/config/predbat.py", line 1070, in run_time_loop self.update_pred(scheduled=True) File "/config/predbat.py", line 617, in update_pred recompute = self.calculate_plan(recompute=recompute) File "/config/plan.py", line 678, in calculate_plan metric, import_kwh_battery, import_kwh_house, export_kwh, soc_min, soc, soc_min_minute, battery_cycle, metric_keep, final_iboost, final_carbon_g = self.run_prediction( File "/config/plan.py", line 2449, in run_prediction ) = pred.run_prediction(charge_limit, charge_window, export_window, export_limits, pv10, end_record, save, step) File "/config/prediction.py", line 857, in run_prediction metric += rate_import[minute_absolute] * diff KeyError: 700
2025-03-05 11:35:13.897576: Info: record_status Error: Exception raised 700 2025-03-05 11:35:13.897798: Error: 700 2025-03-05 11:36:42.074257: Octopus API: Fetching intelligent dispatches for device 30-EB-5A-FF-FF-DE-93-CF 2025-03-05 11:40:07.931395: --------------- PredBat - update at 2025-03-05 11:40:00+00:00 with clock skew 0 minutes, minutes now 700`
Bad gateway:
025-03-05 11:26:41.018398: Warn: Error downloading Octopus data from URL https://api.octopus.energy/v1/products/OUTGOING-VAR-24-10-26/electricity-tariffs/E-1R-OUTGOING-VAR-24-10-26-J/standard-unit-rates/, code 504 2025-03-05 11:26:41.019499: Warn: Unable to download Octopus data from URL https://api.octopus.energy/v1/products/OUTGOING-VAR-24-10-26/electricity-tariffs/E-1R-OUTGOING-VAR-24-10-26-J/standard-unit-rates/ 2025-03-05 11:26:41.090525: Warn: Error downloading Octopus data from URL https://api.octopus.energy/v1/products/OUTGOING-VAR-24-10-26/electricity-tariffs/E-1R-OUTGOING-VAR-24-10-26-J/standing-charges/, code 502 2025-03-05 11:26:41.092041: Warn: Unable to download Octopus data from URL https://api.octopus.energy/v1/products/OUTGOING-VAR-24-10-26/electricity-tariffs/E-1R-OUTGOING-VAR-24-10-26-J/standing-charges/ 2025-03-05 11:26:41.092337: Warning, empty history passed to minute_data, ignoring (check your settings)... 2025-03-05 11:26:41.092429: Warning, empty history passed to minute_data, ignoring (check your settings)... 2025-03-05 11:26:41.208255: Warn: Error downloading Octopus data from URL https://api.octopus.energy/v1/products/INTELLI-VAR-22-10-14/electricity-tariffs/E-1R-INTELLI-VAR-22-10-14-J/standard-unit-rates/, code 502 2025-03-05 11:26:41.209925: Warn: Unable to download Octopus data from URL https://api.octopus.energy/v1/products/INTELLI-VAR-22-10-14/electricity-tariffs/E-1R-INTELLI-VAR-22-10-14-J/standard-unit-rates/ 2025-03-05 11:26:41.280219: Warn: Error downloading Octopus data from URL https://api.octopus.energy/v1/products/INTELLI-VAR-22-10-14/electricity-tariffs/E-1R-INTELLI-VAR-22-10-14-J/standing-charges/, code 502 2025-03-05 11:26:41.281268: Warn: Unable to download Octopus data from URL https://api.octopus.energy/v1/products/INTELLI-VAR-22-10-14/electricity-tariffs/E-1R-INTELLI-VAR-22-10-14-J/standing-charges/ 2025-03-05 11:26:41.282443: Warning, empty history passed to minute_data, ignoring (check your settings)... 2025-03-05 11:26:41.283076: Warning, empty history passed to minute_data, ignoring (check your settings)... 2025-03-05 11:30:09.281290: --------------- PredBat - update at 2025-03-05 11:30:00+00:00 with clock skew 0 minutes, minutes now 690
Why were the octopus rates not available?
I’m hazarding a guess it was a web server issues at the octopus end.
I've released a fix for the bad gateway one.
For the joining saving sessions, it should only try to join if you haven't joined already, did this error continue?
I’ve seem it happen twice over two saving sessions.
Predbat joins the saving sessions, then attempts to join a second time but them stops after that. Any chance it could be a timing or caching issues where the second time it is getting old data.
Yes could be, I put a fix in the latest version to re-fetch the saving sessions after the join so would be interested to see if that solves it.