fix(gateway): emit ad-hoc command serial under "serial", not "dongle_serial"#4096
Open
mgazza wants to merge 1 commit into
Open
fix(gateway): emit ad-hoc command serial under "serial", not "dongle_serial"#4096mgazza wants to merge 1 commit into
mgazza wants to merge 1 commit into
Conversation
…serial" build_command() addresses an inverter by its *inverter* serial (e.g. "CH2330G499"), not the WiFi dongle serial (e.g. "WJ2330G499"). A prior change (aeed2be) renamed the wire key to "dongle_serial" to match the gateway firmware struct field, but that mislabels an inverter serial as a dongle serial. Emit it under "serial" instead. The gateway resolver matches either the dongle or the inverter serial (command_resolve_target_slots), and the firmware accepts both "serial" and "dongle_serial" as the deserialiser key, so this is the honest name and stays compatible. This also matches the serial key the deployed fleet already emits. Update the TestCommandFormat / TestSetChargeSlotPayload expectations to assert the "serial" key (and that "dongle_serial" is absent). Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Summary
build_command()addresses an inverter by its inverter serial (e.g.CH2330G499), not the WiFi dongle serial (e.g.WJ2330G499). A prior change (aeed2bee) renamed the wire key todongle_serialto match the gateway firmware struct field, but that mislabels an inverter serial as a dongle serial.This emits it under
serialinstead.command_resolve_target_slots), so resolution is unaffected.serialanddongle_serialas the deserialiser key, so this stays compatible while using the honest name.serialkey the deployed fleet already emits.Changes
apps/predbat/gateway.py—build_command()emitsserial(wasdongle_serial), with a comment explaining why the value is an inverter serial so it isn't renamed back.apps/predbat/tests/test_gateway.py— updateTestCommandFormat/TestSetChargeSlotPayloadexpectations to assert theserialkey (and thatdongle_serialis absent).Testing
pytest apps/predbat/tests/test_gateway.py— 180 passed.