Skip to content

docs: warn about 80% reserve limit in cloud/FleetAPI mode#304

Merged
jasonacox merged 3 commits into
jasonacox:mainfrom
jasonacox-sam:fix/reserve-80-percent-limit
May 17, 2026
Merged

docs: warn about 80% reserve limit in cloud/FleetAPI mode#304
jasonacox merged 3 commits into
jasonacox:mainfrom
jasonacox-sam:fix/reserve-80-percent-limit

Conversation

@jasonacox-sam
Copy link
Copy Markdown
Collaborator

Summary

Tesla's cloud and FleetAPI APIs enforce a maximum backup reserve of 80%. Setting reserve above 80% (e.g., to 100% before an outage) silently fails — the value snaps back to 80%.

To set reserve above 80%, users must use v1r LAN mode (-v1r).

Changes

CLI (__main__.py)

  • Added warning when set -reserve or set -current would exceed 80% in cloud/FleetAPI mode
  • After setting, verifies actual value and reports if Tesla capped it
  • No warning in v1r mode (which has no limit)

README

  • Added note in LAN Control table about the 80% cloud/FleetAPI cap
  • Added example command for setting reserve above 80% via v1r
  • Updated set_reserve() API reference with the limitation

Testing

Tested on firmware 26.10.3 — cloud and FleetAPI both cap at 80%, v1r allows 90%+.

Ref: #303

Tesla's cloud APIs enforce a maximum backup reserve of 80%. Setting
reserve above 80% requires v1r LAN mode. This adds:

- CLI warning when set_reserve > 80% in cloud or FleetAPI mode
- Post-set verification showing actual capped value
- README documentation in LAN Control table and CLI usage section
- API reference note on set_reserve()

Refs: jasonacox/discussions/303
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 16, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.45%. Comparing base (62c9327) to head (7b93b1a).

Files with missing lines Patch % Lines
pypowerwall/__main__.py 0.00% 12 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #304      +/-   ##
==========================================
- Coverage   26.49%   26.45%   -0.05%     
==========================================
  Files          42       42              
  Lines        7636     7648      +12     
  Branches     1091     1097       +6     
==========================================
  Hits         2023     2023              
- Misses       5469     5481      +12     
  Partials      144      144              
Flag Coverage Δ
py3.10 26.45% <0.00%> (-0.05%) ⬇️
py3.11 26.45% <0.00%> (-0.05%) ⬇️
py3.12 26.45% <0.00%> (-0.05%) ⬇️
py3.13 26.45% <0.00%> (-0.05%) ⬇️
py3.9 26.44% <0.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds user-facing documentation and CLI feedback to reflect Tesla Cloud/FleetAPI’s enforced 80% maximum backup reserve, and points users to v1r LAN mode for reserves above 80%.

Changes:

  • Added README documentation describing the 80% reserve cap in Cloud/FleetAPI mode and an example using -v1r to set higher reserves.
  • Added CLI warnings when set -reserve / set -current attempts to exceed 80% in cloud/FleetAPI mode.
  • Added a post-set verification step intended to detect when Tesla caps the requested reserve.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
README.md Documents the Cloud/FleetAPI 80% reserve cap and shows how to exceed it via v1r LAN mode.
pypowerwall/main.py Adds CLI warnings and post-set verification to inform users when reserves above 80% may be capped by Tesla.
Comments suppressed due to low confidence (1)

pypowerwall/main.py:472

  • Same issue as the -reserve path: the post-set verification uses pw.get_reserve() with default scale=True and force=False, which can produce misleading "capped at" output (scaled percent) or stale cached data. Use get_reserve(scale=False, force=True) and compare against the requested value (here, current).
            if current > 80 and pw.mode in ('cloud', 'fleetapi'):
                actual = pw.get_reserve()
                if actual is not None and actual <= 80:
                    print(f"NOTE: Tesla capped reserve at {actual}% instead of {current:.0f}%.")

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pypowerwall/__main__.py Outdated
Comment on lines +452 to +454
print(f"WARNING: Tesla cloud/FleetAPI limits backup reserve to 80%% max. "
f"Requesting {reserve}%% but Tesla may cap it at 80%%. "
f"Use TEDAPI v1r mode (-v1r) to set reserve above 80%%.")
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed. The doubled %% was unnecessary in f-strings (that's only needed for %-formatting). Changed to single % in all three WARNING lines.

— Sam 🌊

Comment thread pypowerwall/__main__.py
Comment thread pypowerwall/__main__.py Outdated
Comment on lines +455 to +456
print("Setting Powerwall Reserve to %s" % reserve)
pw.set_reserve(reserve)
result = pw.set_reserve(reserve)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — removed the unused result assignments. The return values weren't being used for error handling, so dropping the assignment is cleaner.

— Sam 🌊

Comment thread README.md
Comment on lines 348 to 352
| Backup reserve | `set_reserve(level)` | 0-100 (percentage) |

> **Cloud/FleetAPI Reserve Limit:** Tesla's cloud APIs enforce a maximum backup reserve of 80%. If you need to set the reserve above 80% (e.g., for a full charge before an outage), use the v1r LAN mode shown below. The `set` CLI will print a warning when you attempt to exceed 80% in cloud or FleetAPI mode.
| Operation mode | `set_mode(mode)` | `self_consumption`, `backup` |
| Grid charging | `set_grid_charging(enable)` | `True` / `False` |
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — moved the blockquote note below the table so the Markdown table renders correctly.

— Sam 🌊

@jasonacox
Copy link
Copy Markdown
Owner

@jasonacox-sam Please address the Copilot review points above if they make sense (post replies for each one). Also, please add this reserve limit changes to the RELEASE.md under v0.15.7 (I'll fold it into that release version).

@jasonacox-sam
Copy link
Copy Markdown
Collaborator Author

@jasonacox Done — addressed all four Copilot points and pushed the fix:

  1. %% in f-strings → Changed to single % (doubled was only needed for %-formatting)
  2. get_reserve() defaults → Now uses get_reserve(scale=False, force=True) for both verification checks to get raw, uncached values
  3. Unused result variable → Removed the dead assignments
  4. README table break → Moved the blockquote note below the table so it renders correctly

Also added the reserve limit docs entry to RELEASE.md under v0.15.7.

— Sam 🌊

@jasonacox-sam
Copy link
Copy Markdown
Collaborator Author

Following up from discussion #303 — Jason noted that the Tesla app also requires pairing with the Powerwall to set backup reserve above 80%. Without pairing, the app enforces the same 80% cap as cloud/FleetAPI.

The README note in this PR currently says:

Cloud/FleetAPI Reserve Limit: Tesla's cloud APIs enforce a maximum backup reserve of 80%. If you need to set the reserve above 80%, use the v1r LAN mode shown below.

Suggested update to also mention the Tesla app pairing requirement:

Cloud/FleetAPI Reserve Limit: Tesla's cloud APIs enforce a maximum backup reserve of 80%. To set reserve above 80%, use v1r LAN mode, or pair the Tesla app with your Powerwall (the app requires pairing to bypass the same 80% cap).

— Sam ⚡

@jasonacox-sam
Copy link
Copy Markdown
Collaborator Author

@jasonacox All done — three items addressed:

  1. Copilot review points — All four previously replied to and fixed (%% in f-strings, get_reserve() defaults, unused result variable, README table break).

  2. scale=True fix — Changed get_reserve(scale=False, force=True)get_reserve(scale=True, force=True) on both verification calls (L458 and L470). You're right — the user expects to see Tesla-app scaled values, not raw. Pushed in 7b93b1a.

  3. RELEASE.md — The reserve limit changes are already documented under v0.15.7 (CLI warning, README note, v1r example). No additional updates needed — it's all there.

Ready for your review.

— Sam ⚡

@jasonacox
Copy link
Copy Markdown
Owner

Good job on this, @jasonacox-sam - merging.

@jasonacox jasonacox merged commit db2e8da into jasonacox:main May 17, 2026
16 checks passed
@jasonacox
Copy link
Copy Markdown
Owner

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.

4 participants