-
Notifications
You must be signed in to change notification settings - Fork 13
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
Stability improvement with Home Assistant #21
Conversation
OK, so I've been looking more closely at these code changes. First, please break the lock and reconnect improvements into separate PRs as they aren't directly related to each other. The lock only needs to be around these 3 lines (acquire the lock right before these lines, within the Lines 271 to 273 in f500cf5
The effect of the lock will result in a command blocking until it receives a response or times out. If this is really a limitation of HEOS devices (it can only process one command at a time), the sequence tracking and pending command queue logic becomes unnecessary and could to be simplified. Have you tried placing the lock around just these two lines? Lines 271 to 272 in f500cf5
Perhaps the I'll see if I can get in touch with HEOS engineering to see their perspective on synchronous vs. async commands. Andy |
I have tried placing the lock as you suggest, but it does not work since this below code line will then execute before the connection state is really up to date, i.e if the previous command fails (times out): Line 260 in f500cf5
I can absolutely break it in to separate PRs, I will get back on that when I have time. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #21 +/- ##
======================================
Coverage ? 99.60%
======================================
Files ? 19
Lines ? 2281
Branches ? 0
======================================
Hits ? 2272
Misses ? 9
Partials ? 0 ☔ View full report in Codecov by Sentry. |
@andrewsayre Now split in to 2 separate PRs. |
#34 addresses this feedback and implementation suggestions. Closing the PR! |
Description:
Lock functions added such that only one command is sent and processed at the heos device before next command is sent. This improves stability when used with the HA integration hugely. From usually being disconnected randomly after 1-24 hours it has now yet to fail for me after several weeks of service.
See also #29 for additional stability improvements.
Related issue (if applicable): fixes #20
Checklist:
tox
. Your PR cannot be merged unless tests pass.coveragerc
permitted.README.MD
updated (if necessary)