Skip to content

JBD: retry a timed-out status read when a MOS change is pending - #423

Merged
fl4p merged 1 commit into
fl4p:masterfrom
tednv:fix/jbd-queued-switch-retry
Oct 18, 2026
Merged

fl4p merged 1 commit into
fl4p:masterfrom
tednv:fix/jbd-queued-switch-retry

Conversation

@tednv

@tednv tednv commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

I found this while testing the JBD switch changes from the previous review. The requested changes worked on the physical BMS with keep_alive=False: I turned charging off and back on, and both states were confirmed by the BMS.

I also ran into a separate edge case during that work. If the first status read times out while a charge or discharge change is waiting, Batmon leaves the change queued until a later poll.

This adds one retry when a MOS change is pending. If the retry also times out, the change remains queued so it can be tried again later. Polls without a pending change behave as before.

I added tests for a successful retry and for two consecutive timeouts. The full BMS test suite passes with 1183 passed and 9 skipped.

I tested the command path through Home Assistant on a JBD 14S BMS running firmware 3.2. The timeout did not happen again during the patched hardware test, so the retry itself is covered by the automated test. The physical test confirmed that both charge changes were written and read back correctly.

@fl4p
fl4p merged commit 42be251 into fl4p:master Oct 18, 2026
5 checks passed
@fl4p

fl4p commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Thanks for testing on real hardware. #423 looks good: the retry only applies with a change pending, and a second timeout still leaves it queued. Merging.

fl4p added a commit that referenced this pull request Oct 18, 2026
…t fragment can succeed

A timed-out reply that lost its tail left its head in the notification
buffer; the next reply was appended to it, failed its checksum, and the
#423 retry timed out too. Tests drive the real handler and pin the retry
to once and to pending switches only.
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