Fix onvif writing to closing transport#33970
Fix onvif writing to closing transport#33970indykoning wants to merge 1 commit intohome-assistant:devfrom indykoning:feature/fix_onvif_write_to_closing_transport
Conversation
There was a problem hiding this comment.
Same issue here, PTZ was not working for me because two functions to get the PTZ service were being called in quick succession.
After reducing this to a single function i can now use PTZ
|
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. |
|
Please solve the merge conflict. @hunterjm do you have time to review? |
|
A lot of these same concerns were addressed in the recent refactor. I did not add additional waits, however. Could you check this on 0.110 and see if your issues are resolved without the additional waits? |
|
Sadly it did not fix all of them for me, luckily i could remove a ton of them so far. I also got an error core/homeassistant/components/onvif/device.py Line 270 in b42a197 Maybe my camera does not support the presets. Anyhow, i caught that exception to allow setup to be completed and PTZ does not seem to be affected for the camera |
|
I have fixed the merge conflict 👍 |
|
@indykoning - I'm sorry to do this to you again, but I've made a ton of bugfix releases, and one of them (#35932) had a large impact on how Transports work. That made it into 0.110.2. Could you see if that fixed your issue, or if the sleeps are still required in some places? |
|
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. |
Proposed change
(Probably) cheaper cameras do not seem to close the request quickly enough, resulting in it being closed while the next request is being made. First i saw duplicate code doing the same thing, retrieving profiles unnecessarily. So i made a helper function to retrieve the profile and save it to serve it next time this function gets called.
Then when multiple requests were being made in very quick succession the second request would fail with "Cannot write to closing transport". When i add a wait of 0.1s to this the transport will have been closed and a new one can be created.
Run less unnecessary requests, wait a little longer to allow camera to close the request before opening next request.
Type of change
Example entry for
configuration.yaml:Additional information
Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following Integration Quality Scale: