Repository navigation
Conversation
…0xFF00 The specification (6.5) allows only 0xFF00 (ON) and 0x0000 (OFF); any other value is illegal, must not affect the coil, and gets exception 03. The server took any non-zero value as ON and echoed 0xFF00. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch has not been deployed
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.
A Write Single Coil request (0x05) with a value other than 0xFF00 or 0x0000 was carried out. Any non-zero value turned the coil ON, and the response echoed 0xFF00, a value the client didn't send. The Modbus Application Protocol (V1.1b3, 6.5) says "All other values are illegal and will not affect the output", and its state diagram answers exception 03.
The change:
WriteSingleCoilRequestkeeps the decoded value, anddatastore_updateanswersILLEGAL_VALUEfor any other value before it touches the datastore. That is the same place #3066 checks counts. A request built through the API (no decoded value) is unchanged.Tests:
05 0000 0001now gets85 03. Before, it got05 0000 ff00and the coil was turned ON.dev(b9cd6c6) and pass here. codespell, ruff, pylint, zuban and pytest (100 % coverage) pass.Found by a differential test against libmodbus, which answers exception 03 to the same request.
🤖 Generated with Claude Code