Repository navigation
fix(api): /pod status flags null when the gateway has no value - #206
Merged
Merged
Conversation
The seven POD status flags (ActiveHeating, ChargeComplete, ChargeRequest, DischargeComplete, PermanentlyFaulted, PersistentlyFaulted, enable_line) went through int(x or 0), so TEDAPI vitals' None became 0 and read like a measured "not faulted" (pypowerwall#179). Keep None; values the gateway reports are converted as before. Parity with proxy t115. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change preserving unavailable /pod status flags as null.
No open issues 🎉
What changed in this PR
Updates the legacy /pod endpoint to distinguish unavailable battery status flags from measured zero values, aligning with the related pypowerwall proxy fix.
Changes:
- Preserves
nullfor seven unavailable POD status flags while retaining existing conversion for reported values. - Adds regression coverage for unavailable, boolean, numeric, and missing flag values.
- Documents the behavior change in the upcoming release notes.
| File | Description |
|---|---|
tests/test_api_legacy.py |
Tests null preservation and conversion of reported status flags. |
RELEASE.md |
Records the /pod fix and compatibility details. |
app/api/legacy.py |
Centralizes the seven status flags and preserves unavailable values as null. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the
/podside of jasonacox/pypowerwall#179, which @clonea1 flagged. Pairs with the proxy PR jasonacox/pypowerwall#476.Problem: TEDAPI vitals have no source for the seven POD status flags (
POD_ActiveHeating,POD_ChargeComplete,POD_ChargeRequest,POD_DischargeComplete,POD_PermanentlyFaulted,POD_PersistentlyFaulted,POD_enable_line)./podturned theirNoneinto0withint(x or 0), which reads like a measured "not faulted".Fix: keep
nullwhen the gateway has no value. Values the gateway does report convert exactly as before.Compatibility:
/podalready sendsnullfor these keys when vitals are missing.nullfields and keeps the rest of the record. I tested this with the JSON parser the Dashboard uses.rawstore (3 days) holds them.Tests:
test_pod_status_flags_null_when_unavailablecovers a TEDAPI unit (allnull) and a local unit (real booleans, one key missing). It fails with the old code.🤖 Generated with Claude Code