Repository navigation
feat(gateway): sync internal-DRAM fields into the shared status schema - #4495
Merged
Merged
Conversation
Mirrors the three fields added to the gateway firmware's copy of gateway_status.proto. The two copies must stay in sync for wire compatibility. heap_internal_free (15) heap_internal_largest (16) heap_internal_min_free (17) Why they exist: free_heap_bytes (9) is ESP.getFreeHeap(), which can include PSRAM and so cannot predict the allocations that actually fail on the device — WiFi/lwIP/TLS/AsyncTCP buffers, task stacks and lwIP PCBs all need internal DRAM specifically. A hub silently lost its :80 listener (and with it the OCPP endpoint its EV charger connects to) for two days; field 9 looked fine throughout, while largest-contiguous-block was the number that showed the squeeze. Fields are appended, so both directions stay compatible — verified by round-trip across the old and new generated bindings: new firmware -> old PredBat: parses cleanly, unknown fields ignored old firmware -> new PredBat: parses, heap fields default to 0 That matters because firmware and PredBat version independently. No entities are published from these yet; the cloud consumes the status message directly. Exposing them in Home Assistant would add entities to every install and is a separate decision. Regenerated with protoc 34.1, then reformatted by the repo's black hook. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…nal DRAM Comment-only, mirroring the firmware copy. MALLOC_CAP_INTERNAL alone can include regions that are not byte-addressable; lwIP objects, task stacks and most library allocations need internal 8-bit-capable memory specifically, so the firmware queries MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT for these fields. Querying the wider set would overstate usable headroom — several KB can remain in an internal 32-bit/IRAM region while 8-bit DRAM is exhausted and allocations still fail. No wire or field-number change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Keeps
apps/predbat/gateway_status.protoin sync with the gateway firmware's copy — the two must match for wire compatibility.Adds three fields to
GatewayStatus:Why:
free_heap_bytes(9) isESP.getFreeHeap(), which can include PSRAM and so cannot predict the allocations that actually fail on the device — WiFi/lwIP/TLS/AsyncTCP buffers, task stacks and lwIP PCBs all need internal DRAM specifically.A hub silently lost its port-80 listener, and with it the OCPP endpoint its EV charger connects to, for two days. Field 9 looked healthy throughout; largest-contiguous-block was the number that showed the squeeze (19,851 B free but only 17,396 B largest).
Compatibility: fields are appended, so both directions work. Verified by round-tripping across the old and new generated bindings in separate processes:
That matters because gateway firmware and PredBat version independently.
No entities are published from these — the cloud consumes the status message directly. Exposing them in Home Assistant would add entities to every install and is a separate decision.
Regenerated with
protoc34.1.pytest apps/predbat/tests/test_gateway.py— 263 pass.🤖 Generated with Claude Code