Skip to content

fix(api): /pod status flags null when the gateway has no value - #206

Merged
jasonacox merged 1 commit into
mainfrom
fix/pod-flags-none
Nov 12, 2026
Merged

jasonacox merged 1 commit into
mainfrom
fix/pod-flags-none

Conversation

@jasonacox

@jasonacox jasonacox commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Fixes the /pod side 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). /pod turned their None into 0 with int(x or 0), which reads like a measured "not faulted".

Fix: keep null when the gateway has no value. Values the gateway does report convert exactly as before.

Compatibility:

  • No key is added or removed. /pod already sends null for these keys when vitals are missing.
  • Telegraf 1.28.2 (the Dashboard's image) skips null fields and keeps the rest of the record. I tested this with the JSON parser the Dashboard uses.
  • No Powerwall-Dashboard panel, continuous query or tool reads these flags. Only the raw store (3 days) holds them.

Tests:

  • New test_pod_status_flags_null_when_unavailable covers a TEDAPI unit (all null) and a local unit (real booleans, one key missing). It fails with the old code.
  • Full suite: 1367 passed.

🤖 Generated with Claude Code

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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 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 null for 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

@jasonacox
jasonacox merged commit 0580ac1 into main Nov 12, 2026
11 checks passed
@jasonacox
jasonacox deleted the fix/pod-flags-none branch November 12, 2026 05:47
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.

2 participants