8000 Fix modbus transaction response by janiversen · Pull Request #33824 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix modbus 8000 transaction response #33824

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

Merged
merged 1 commit into from
Apr 8, 2020

Conversation

janiversen
Copy link
Member

Breaking change

Proposed change

Sometimes a modbus server do not respond to a transaction,
this is a contradiction to the modbus protocol specification,
but merely a matter of fact.

This patch implements a timeout (as configured in the modbus: platform or default 3sec),
which cancels the transaction and sets unavailable (next scan cycle, will hopefully get a value).

Type of change

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

Example entry for configuration.yaml:

# Example configuration.yaml

Additional information

Checklist

  • [ x] The code change is tested and works locally.
  • [ x] Local tests pass. Your PR cannot be merged unless tests pass
  • [ x] There is no commented out code in this PR.
  • [ x] I have followed the development checklist
  • [ x] 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.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

@probot-home-assistant probot-home-assistant bot added integration: modbus small-pr PRs with less than 30 lines. labels Apr 8, 2020
@probot-home-assistant
Copy link

Hey there @adamchengtkc, mind taking a look at this pull request as its been labeled with a integration (modbus) you are listed as a codeowner for? Thanks!

@balloob balloob added this to the 0.108.1 milestone Apr 8, 2020
@MartinHjelmare MartinHjelmare changed the title Modbus: fix to issue #33754 Fix modbus transaction response Apr 8, 2020
8000
Sometimes a modbus server do not respond to a transaction,
this is a contradiction to the modbus protocol specification,
but merely a matter of fact.

Use asynio.await_for() to provoke a timeout, and close the
transaction.
@janiversen janiversen force-pushed the modbus_patch_issue1 branch from 31beb98 to 66c31d2 Compare April 8, 2020 19:40
@janiversen
Copy link
Member Author

@MartinHjelmare changed according to your suggestion (and tested).

I updated the commit (look for _read and _write).

@balloob you approved the PR earlier, so just informing you that the content have changed slightly.

Copy link
Member
@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Thanks!

For the future, please don't squash commits after review has started to make it easier for readers to track changes. We'll squash when merging.

@janiversen
Copy link
Member Author

hmmm:
[command]/bin/bash --noprofile --norc /__w/_temp/7b7a2d82-6dbb-47f0-8b07-e92b0795174b.sh
2020-04-08T19:45:45.8538914Z [INFO] Installing environment for https://github.com/pre-commit/mirrors-isort.
2020-04-08T19:45:45.8551018Z [INFO] Once installed this environment will be reused.
2020-04-08T19:45:45.8551533Z [INFO] This may take a few minutes...
2020-04-08T19:45:59.8191430Z isort....................................................................Failed
2020-04-08T19:45:59.8193871Z - hook id: isort
2020-04-08T19:45:59.8194996Z - files were modified by this hook
2020-04-08T19:45:59.8195685Z
2020-04-08T19:45:59.8196363Z Fixing /__w/1/s/homeassistant/requirements.py
is this really my error ?

@MartinHjelmare
Copy link
Member

No, that's not you. Sorry. It's fixed on dev now. It would be good to rebase this PR on dev again to make sure nothing else is wonky.

@balloob
Copy link
Member
balloob commented Apr 8, 2020

I'll merge it, I want to tag the beta :)

@balloob balloob merged commit 2d1002d into home-assistant:dev Apr 8, 2020
balloob pushed a commit that referenced this pull request Apr 9, 2020
Sometimes a modbus server do not respond to a transaction,
this is a contradiction to the modbus protocol specification,
but merely a matter of fact.

Use asynio.await_for() to provoke a timeout, and close the
transaction.
@balloob balloob mentioned this pull request Apr 9, 2020
@jorgror
Copy link
Contributor
jorgror commented Apr 11, 2020

This or the other change to modbus seems to have broken something related to my modbus setup. I don't have a good enough understanding of either modbus protocol or the change that is implemented in these PR. See mine https://community.home-assistant.io/t/0-108-logos-area-pages-lovelace-entity-card-lovelace-map-history/184891/309?u=jolo and also this report: https://community.home-assistant.io/t/0-108-logos-area-pages-lovelace-entity-card-lovelace-map-history/184891/68

@MartinHjelmare
Copy link
Member

Please open an issue if you suspect a bug.

Merged PRs should not be used for support or bug reports. Thanks!

@home-assistant home-assistant locked as resolved and limited conversation to collaborators Apr 11, 2020
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.

Modbus broken in 0.108b
5 participants
0