Skip to content
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

Ignore size check for DataType.CUSTOM in modbus #101523

Closed
wants to merge 1 commit into from
Closed

Ignore size check for DataType.CUSTOM in modbus #101523

wants to merge 1 commit into from

Conversation

nikito7
Copy link
Contributor

@nikito7 nikito7 commented Oct 6, 2023

Breaking change

Proposed change

Last count changes breaked non standard 32 bits modbus

PR result:

Screenshot_20231005_134419_Home_Assistant

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link

home-assistant bot commented Oct 6, 2023

Hey there @janiversen, mind taking a look at this pull request as it has been labeled with an integration (modbus) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of modbus can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign modbus Removes the current integration label and assignees on the pull request, add the integration domain after the command.

Copy link
Member

@janiversen janiversen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

byte_count is calculated by the pack functions, also in case of datatype custom, so the check is needed to avoid a runtime exception, when struct is defined wrongly.

Please add tests that show a custom struct configured wrongly do not cause a runtime exception.

@janiversen
Copy link
Member

Just for information, the documentation states:

quote "The integration adheres strictly to the protocol specification for the actual protocol implementation."

so non-standard is not supported, but if it works it's fine.

Any PR that implement a non-standard functionality and do not put the standard at risk (by e.g. provoking a runtime error in case of a wrong configuration) will be accepted.

@nikito7
Copy link
Contributor Author

nikito7 commented Oct 6, 2023

Just for information, the documentation states:

quote "The integration adheres strictly to the protocol specification for the actual protocol implementation."

so non-standard is not supported, but if it works it's fine.

Any PR that implement a non-standard functionality and do not put the standard at risk (by e.g. provoking a runtime error in case of a wrong configuration) will be accepted.

I know.

I only try apply for custom and maybe string.

Current test fail.

After you change count this is needed.

Current modbus component if have issues creates a delay in boot/restart from 1min to 5min.

Personally I avoid to use modbus component, but some users still need it

Any plans in modbus standards for an update?
Still in 2006c version?

The funny thing, the issue is only in request for almost implementations.
Some check for count in response too, that is more complex to fix.

I tried fix this "32bits count 1" everywhere.
But as you say and it's true, it is non standard.

Regards

@janiversen
Copy link
Member

Yes current test fails, please implement changes according to the review comments. The tests are there for a reason, so if a test fails it because something is not working as it should.

@MartinHjelmare MartinHjelmare changed the title Ignore size check for DataType.CUSTOM Ignore size check for DataType.CUSTOM in modbus Oct 7, 2023
@janiversen
Copy link
Member

Anything happening on this PR, if no response it will be closed in 72 hours.

@janiversen
Copy link
Member

and that means ?

@nikito7
Copy link
Contributor Author

nikito7 commented Oct 28, 2023

I currently don't have time

@nikito7 nikito7 deleted the ignore-size-check branch October 28, 2023 19:03
@janiversen
Copy link
Member

as we have seen before....but thanks for trying.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants