Skip to content

fix(tesla): retry site_info after transient network failures #29

Description

@Artic0din

Problem

A transient Tesla/PowerSync API failure permanently disables site_info fetches until the integration reloads or Home Assistant restarts.

Evidence

At 03:08:15, four concurrent site_info calls exhausted their retries during a wider DNS/network outage. Each logged:

Failed to fetch site_info: ... (will not retry until next restart)

No further fetch occurred after network recovery. Fetching resumed only after the config entry reloaded at 06:03:57.

The live 2.12.857 coordinator sets _site_info_fetch_failed = True; every later call immediately returns None.

Root cause

The negative cache does not distinguish permanent configuration/authentication failures from transient DNS, connection, or timeout failures. It has no expiry or recovery probe.

Proposed fix

  • Classify authentication/configuration failures separately from transient transport failures.
  • Replace the permanent boolean negative cache for transient failures with timestamped exponential backoff.
  • Preserve and return the last valid cached payload while a retry is deferred.
  • Log one failure transition and one recovery transition rather than every caller.
  • Retain explicit re-authentication behavior for genuine credential failures.

Acceptance criteria

  • A DNS or connection failure retries automatically after backoff without reload/restart.
  • A successful retry clears the failure state and logs recovery once.
  • Cached valid site_info remains available during a transient outage.
  • Authentication failures do not create an aggressive retry loop.
  • Tests cover timeout, DNS failure, auth failure, cached fallback, and recovery.

Migration source: PLA-154
Linear status at cutover: Backlog
Cut over to GitHub on 2026-07-22.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions