Skip to content

Bugfix 105: Use Unit ID name #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sgryphon
Copy link

Fixes issue #105

Change parameter name and internal references to Unit Identifier, to align with the current MODBUS standards.

Backwards compatibility added for old parameter name, with several test cases kept using the old name to verify it works.

Errors added where neither value is supplied and the field is mandatory (for RTU device). To do this the name parameter had to also be made optional, as it comes after unit_id (i.e. to preserve positional calls), so a check was added for it as well.

In both cases a deprecation warning was added if the old name was used.

Documentation updated for the new name, and most tests changed to use the new parameter name (some tests were left using the old name, to test the backwards compatibility, and some already used positional arguments).

@sgryphon
Copy link
Author

You might still want to consider this a breaking change, even though backwards compatibility was added, because Python doesn't have private code, so all the internal methods all changed, if you call them with named parameters (and not just positionally).

All the unit tests, which are presumably the main API used, are backwards compatible.

sgryphon added 3 commits June 7, 2025 20:29
Modernizes the Modbus terminology by using "unit ID" throughout the codebase.
This addresses issue sunspec#105 by:

- Renaming parameters and variables to unit_id
- Updating method signatures while maintaining backward compatibility
- Revising documentation and comments to reflect current industry standards
- Ensuring consistent terminology across the entire Modbus implementation

This change improves code readability and aligns with current Modbus
specification terminology while maintaining full backward compatibility.
Updates test cases to align with the modernized unit ID terminology.
Ensures all tests properly exercise the updated API while maintaining
complete test coverage include backward compatibility tests.
@sgryphon sgryphon force-pushed the sgryphon/105-use-unit-id-name branch from f9ce125 to 0deeff3 Compare June 7, 2025 10:32
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.

1 participant