Skip to content

futurerate.py: requests.get() has no timeout - a stalled Nord Pool connection freezes the main loop indefinitely (follow-up to #1469) #4525

Closed

Description

@CorruptedClown

Describe the bug

The Nord Pool day-ahead fetch in futurerate.py (download_futurerate_data_func, currently line 415) calls:

r = requests.get(url)

with no timeout argument. If the TCP connection stalls silently (established but no response - e.g. a mid-transfer network drop, rather than a clean connection failure), no exception is raised, so the surrounding try/except from #1469 never fires, and the call blocks the main prediction loop forever.

This happened to me on 2026-08-15 at midnight (v8.48.1): the update run reached the futurerate fetch and the main loop then hung for over 4 hours until I restarted the add-on manually. Because background threads (Solcast, Axle, history pruning) keep running, the add-on looks healthy - predbat.status stays on its last value with error=false, and no new plan runs happen. Meanwhile the inverter stayed latched in the last commanded state (a force-export slot in my case), which drained the battery to 0% overnight and missed the whole cheap import window.

Log extract (everything from the main loop simply stops after the fetch line; the LoadML timeout 2 hours later is a downstream symptom - it was waiting for the prediction cycle to complete):

2026-08-15 00:00:02.305444: FutureRate: Detected import tariff E-1R-INTELLI-FIX-12M-26-06-13-E agile False export tariff E-1R-AGILE-OUTGOING-19-05-13-E agile True
2026-08-15 00:00:02.305478: Fetching futurerate data from https://dataportal-api.nordpoolgroup.com/api/DayAheadPrices?date=DATE&market=N2EX_DayAhead&deliveryArea=UK&currency=GBP
  [no further main-loop output - no more "PredBat - update at" headers or plan calculations]
2026-08-15 02:06:29.719588: Error: LoadMLComponent: run() exceeded 7200s timeout:
2026-08-15 02:06:29.719688: Warn: LoadMLComponent: run() returned False

This looks like the same failure family as #1469 ("Internet connection failure not trapped, predbat freezes", Sept 2024). That fix added the try/except, which handles connection errors - but a silent stall raises nothing to catch. The bare requests.get(url) has been unchanged since futurerate.py was created in the #1655 code split (Nov 2024) and is still on current main.

Expected behaviour

A hung Nord Pool connection should time out after a bounded period, get caught by the existing exception handler, retry (the existing 3-attempt loop), and fall back to cached rates - i.e. exactly what the #1469 error path already does for clean failures.

Suggested one-line fix:

r = requests.get(url, timeout=30)

(or timeout=(10, 30) for separate connect/read timeouts). I've been running this patch locally on two installs since the incident with no ill effects - a stalled fetch now falls back to cached data as intended.

Predbat version

v8.48.1 (HAOS add-on 1.7.1)

Environment details

  • Sigenergy SigenStor EC 6.0 SP, 18 kWh battery, HAOS add-on install
  • Octopus Intelligent GO import + Agile Outgoing export; futurerate configured for Nord Pool N2EX
  • Incident coincided with the midnight cache rollover, when a fresh fetch for the new date is required

Screenshots

N/A - not a plan issue; log extract above shows the hang.

Log file

Extract above; happy to provide the full predbat.log for the incident window if useful.

Predbat debug yaml file

N/A - not a plan calculation issue (the loop never reaches plan calculation while hung).

Activity

  1. added a commit that references this issue on Aug 15, 2026
    fdcad07
  2. added a commit that references this issue on Aug 16, 2026
    06beccc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions