Skip to content

Mark local-path errors failover_safe for tesla_fleet_api's Router - #37

Merged
Bre77 merged 1 commit into
mainfrom
fm/apw-failover-safe-markers
Oct 29, 2026
Merged

Bre77 merged 1 commit into
mainfrom
fm/apw-failover-safe-markers

Conversation

@Bre77

@Bre77 Bre77 commented Oct 29, 2026

Copy link
Copy Markdown
Member

Teslemetry/python-tesla-fleet-api#200 makes the Router fail over only on errors marked failover-safe. Without a marker, an EnergySiteRouter whose local gateway is unreachable would stop failing over to the cloud.

  • Sets the class attribute failover_safe = True (the mechanism PR 200 defines) on PowerwallConnectionError, PowerwallRateLimitError and PowerwallAuthenticationError.
  • Leaves PowerwallCommandError (and PowerwallNotSupportedError) unmarked: the gateway answered and rejected the command, so the cloud would reach the same device.
  • Adds tests/test_exceptions.py. The tesla-protocol pin stays >=4.0.0,<5.

@Bre77 Bre77 mentioned this pull request Oct 29, 2026
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 3be13d9 and d6f9d83.

Files selected for processing: 2
  • src/aiopowerwall/exceptions.py
  • tests/test_exceptions.py

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Walkthrough

Three Powerwall error classes now define failover_safe = True. Tests check these markers and verify that command and unsupported-operation errors are not marked true.

Changes: Failover error classification

Layer / File(s) Summary
Error markers and classification tests
src/aiopowerwall/exceptions.py, tests/test_exceptions.py
Connection, authentication, and rate-limit errors define failover_safe = True. Tests check these markers and confirm command and unsupported-operation errors are not marked true.

Priority: Normal

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · up to d6f9d

The change is consistent with the intended failover behavior and includes focused marker tests.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: marking local-path Powerwall errors as failover-safe for the tesla_fleet_api Router.
Description check Passed The description directly explains the failover behavior, the marked and unmarked error classes, the added tests, and the dependency constraint.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@Bre77
Bre77 merged commit 2eac1aa into main Oct 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant