Repository navigation
Conversation
byteCount of a Report Slave ID response covers the slave ID and the run indicator status byte. The layer used it as the slave ID length, so a response could not be built without an explicit byteCount, and a response from a device was dissected as Raw. AI-Assisted: yes (Claude Opus 5.5, GPT-6.1 Sol)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5249 +/- ##
==========================================
+ Coverage 81.17% 81.18% +0.01%
==========================================
Files 394 394
Lines 98770 98770
==========================================
+ Hits 80178 80188 +10
+ Misses 18592 18582 -10
🚀 New features to boost your workflow:
|
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.
Description
In a Report Slave ID response,
byteCountcounts the slave ID and the run indicator status byte (the Modbus application protocol specification, function 0x11; pymodbus and libmodbus encode it this way).ModbusPDU11ReportSlaveIdResponseusesbyteCountas the slave ID length. As a result, building the response without an explicitbyteCountraisesTypeError, and a response from a device does not dissect.Before:
After:
The existing test
raw(ModbusPDU11ReportSlaveIdResponse(byteCount=3, slaveId="ID")) == b'\x11\x03\x49\x44\x00'already uses this meaning ofbyteCountand still passes.This message was written with the help of AI (Claude Opus 5.5).