Fix onvif ConnectionResetError (#45899)

Fix "ConnectionResetError: Cannot write to closing transport" error we can have on lots of chinese cams(like Goke GK7102 based IP cameras)
Those non full onvif compliant cams can "crash" when calling non implemented functions like events or ptz and they are likely react by closing transport, leaving the request in a uncatched error state.

My camera used to fail on setup, and now it run nicely with that simple fix.
This commit is contained in:
olijouve 2021-02-04 09:25:35 +01:00 committed by GitHub
parent 1b6ee8301a
commit 8256acb8ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -250,14 +250,14 @@ class ONVIFDevice:
pullpoint = False
try:
pullpoint = await self.events.async_start()
except (ONVIFError, Fault):
except (ONVIFError, Fault, RequestError):
pass
ptz = False
try:
self.device.get_definition("ptz")
ptz = True
except ONVIFError:
except (ONVIFError, Fault, RequestError):
pass
return Capabilities(snapshot, pullpoint, ptz)