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

Avoid concurrent radio operations with powerview hubs #114399

Merged
merged 4 commits into from
Mar 29, 2024
Merged

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Mar 28, 2024

Proposed change

These devices tend to crash if there are concurrent radio operations. PARALLEL_UPDATES was set to 1 to try to avoid this problem, but it turned out not to be enough

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

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 Ruff (ruff format 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:

fixes #73900

These devices tend to crash if there are concurrent radio
operations. PARALLEL_UPDATES was set to 1 to try to avoid
this problem, but it turned out not to be enough
@home-assistant
Copy link

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

Code owner commands

Code owners of hunterdouglas_powerview 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 hunterdouglas_powerview Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@trullock
Copy link
Contributor

Is this the crashing bug fix?

@bdraco
Copy link
Member Author

bdraco commented Mar 28, 2024

Is this the crashing bug fix?

That's the hope

@bdraco bdraco added this to the 2024.4.0 milestone Mar 28, 2024
@bdraco bdraco marked this pull request as ready for review March 28, 2024 22:23
Copy link
Contributor

@kingy444 kingy444 left a comment

Choose a reason for hiding this comment

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

Must have missed this one in the previous PR's

homeassistant/components/hunterdouglas_powerview/select.py Outdated Show resolved Hide resolved
@kingy444
Copy link
Contributor

Trying to read up on the asyncio.lock method - will this queue the calls of block them completely?

Co-authored-by: kingy444 <toddlesking4@hotmail.com>
@bdraco
Copy link
Member Author

bdraco commented Mar 28, 2024

Trying to read up on the asyncio.lock method - will this queue the calls of block them completely?

It will only allow one of the calls to happen at a time so they line up waiting for previous calls to finish. If nothing is in progress it will run right away

@frenck frenck merged commit 63ccdcb into dev Mar 29, 2024
21 checks passed
@frenck frenck deleted the powerview_crash_fix branch March 29, 2024 15:20
@chrisjenx
Copy link

As far as I'm aware the Hub will return an API call even if the radio is still doing something, I can't really see where it waits for the radio? (Kotlin Engineer not Python - also know little about the HA code base)

frenck pushed a commit that referenced this pull request Mar 29, 2024
Co-authored-by: kingy444 <toddlesking4@hotmail.com>
@kingy444
Copy link
Contributor

As far as I'm aware the Hub will return an API call even if the radio is still doing something, I can't really see where it waits for the radio? (Kotlin Engineer not Python - also know little about the HA code base)

Pretty fair point and probably a big contributor to the issue some users see (there are plenty who don't experience the issue)

The only time the API "waits" that I have seen is when you force a position refresh.

So with that in mind, maybe this will do nothing, but it shouldn't hurt to try it out either...

It should at the very least prevent a HA automation sending a move command to every shade concurrently. (Personally my hub can handle this, but others have advised this can contribute to a lockup)

@github-actions github-actions bot locked and limited conversation to collaborators Mar 30, 2024
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.

Powerview Polling causing timeout errors
6 participants