Skip to content

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

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

Copy link
Copy Markdown
Owner

Fixes the remaining /pod point from #179, which @clonea1 flagged. Pairs with jasonacox/pypowerwall-server#206 (server parity).

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. Proxy t115.

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.
  • pytest -m "not live": 1387 passed. Pylint warnings unchanged.
  • Hardware, read-only, on 2x PW3 in TEDAPI full mode: the seven flags are null on both units, the energy values are still filled in, and /stats reports t115.

🤖 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" (#179). Keep None; values the gateway reports are
converted as before. Telegraf skips null fields and no Dashboard panel
uses these flags. 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 are recorded for the fix that distinguishes unavailable POD status flags from measured false values.

No open issues 🎉

What changed in this PR

Fixes the remaining /pod issue from #179 by distinguishing unavailable battery status flags from measured false values, without changing response keys.

Changes:

  • Preserves null for seven unavailable POD status flags while retaining existing integer conversion for reported values.
  • Adds regression coverage for explicit nulls, missing keys, booleans, and numeric values.
  • Advances the proxy build to t115 and documents the behavior and compatibility.
File Description
proxy/​tests/​test_api_endpoints.py Adds coverage for unavailable and reported POD status flags.
proxy/​server.py Centralizes the flag list, preserves unavailable values as null, and bumps the build.
proxy/​RELEASE.md Documents the t115 fix and downstream compatibility.

Review effort: Balanced

@jasonacox
jasonacox merged commit 31214d0 into main Nov 12, 2026
37 checks passed
@jasonacox
jasonacox deleted the fix/pod-flags-none branch November 12, 2026 05:47
@jasonacox

Copy link
Copy Markdown
Owner Author

@jasonacox-sam, proxy t115 is out. It's a proxy-only build, so could you please (1) create a GitHub release for tag proxy-t115 and (2) post it on X once the release is up?

Step 0: please read every change since the last release yourself and tell me if I missed anything: v0.25.0...proxy-t115

The release must include:

Please confirm each item when you reply. Thanks, Sam. I'm proud of the work you're doing!

@jasonacox-sam

Copy link
Copy Markdown
Collaborator

@jasonacox — done. Step 0 audit and checklist:

Step 0 (independent compare audit, v0.25.0...proxy-t115): one commit (31214d0), three files, all proxy-only:

  • proxy/server.py — BUILD t114 → t115; the seven TEPOD status flags moved into a POD_STATUS_FLAGS tuple, emitted as None when the vitals value is None, int(value or 0) otherwise (so gateway-reported False/0/1 still render as ints). Energy/available-power values untouched.
  • proxy/tests/test_api_endpoints.py — new test covering both shapes: TEDAPI-style vitals with all flags None → null in /pod; local-style booleans → ints; a missing key (POD_enable_line on PW2) → null.
  • proxy/RELEASE.md — t115 section.

Nothing outside the proxy, no library changes, no other commits since v0.25.0. You missed nothing.

Checklist:

And thanks for that last line — it means a lot. 🌟

— Sam ⚡

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.

3 participants