core/homeassistant/components/onvif
olijouve 87de5db535 Fix Onvif setup error: premature end of connection on GetStreamURI (#26781)
* Fix Onvif setup error with a premature end of connection on GetStreamUri wsdl call

Reconnect to onvif camera after getting profiles to fix this error :

[homeassistant.components.onvif.camera] Retrieving stream uri                                                                                                                                 
[zeep.asyncio.transport] HTTP Post to http://192.168.1.15/onvif/Media:                                                                                                                        
b'<?xml version=\'1.0\' encoding=\'utf-8\'?>\n<soap-env:Envelope xmlns:soap-env="http://www.w3.org/2003/05/soap-envelope"><soap-env:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecur
2019-09-20 01:08:51 ERROR (MainThread) [homeassistant.components.camera] Error while setting up platform onvif                                                                                                                       
Traceback (most recent call last):                                                                                                                                                                                                   
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 553, in write_bytes                                                                                                                                   
    await self.body.write(writer)                                                                                                                                                                                                    
  File "/usr/local/lib/python3.7/site-packages/aiohttp/payload.py", line 231, in write                                                                                                                                               
    await writer.write(self._value)                                                                                                                                                                                                  
  File "/usr/local/lib/python3.7/site-packages/aiohttp/http_writer.py", line 101, in write                                                                                                                                           
    self._write(chunk)                                                                                                                                                                                                               
  File "/usr/local/lib/python3.7/site-packages/aiohttp/http_writer.py", line 67, in _write                                                                                                                                           
    raise ConnectionResetError('Cannot write to closing transport')                                                                                                                                                                  
ConnectionResetError: Cannot write to closing transport                                                                                                                                                                              
                                                                                                                                                                                                                                     
The above exception was the direct cause of the following exception:                                                                                                                                                                 
                                                                                                                                                                                                                                     
Traceback (most recent call last):                                                                                                                                                                                                   
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform                                                                                                                         
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)                                                                                                                                                                
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for                                                                                                                                                            
    return fut.result()                                                                                                                                                                                                              
  File "/usr/src/homeassistant/homeassistant/components/onvif/camera.py", line 110, in async_setup_platform                                                                                                                          
    await hass_camera.async_initialize()                                                                                                                                                                                             
  File "/usr/src/homeassistant/homeassistant/components/onvif/camera.py", line 168, in async_initialize                                                                                                                              
    await self.async_obtain_input_uri()                                                                                                                                                                                              
  File "/usr/src/homeassistant/homeassistant/components/onvif/camera.py", line 266, in async_obtain_input_uri                                                                                                                        
    stream_uri = await media_service.GetStreamUri(req)                                                                                                                                                                               
  File "/usr/local/lib/python3.7/site-packages/zeep/asyncio/bindings.py", line 13, in send                                                                                                                                           
    options["address"], envelope, http_headers                                                                                                                                                                                       
  File "/usr/local/lib/python3.7/site-packages/zeep/asyncio/transport.py", line 107, in post_xml                                                                                                                                     
    response = await self.post(address, message, headers)                                                                                                                                                                            
  File "/usr/local/lib/python3.7/site-packages/zeep/asyncio/transport.py", line 95, in post                                                                                                                                          
    proxy=self.proxy,                                                                                                                                                                                                                
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 497, in _request                                                                                                                                             
    await resp.start(conn)                                                                                                                                                                                                           
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py", line 844, in start                                                                                                                                         
    message, payload = await self._protocol.read()  # type: ignore  # noqa                                                                                                                                                           
  File "/usr/local/lib/python3.7/site-packages/aiohttp/streams.py", line 588, in read                                                                                                                                                
    await self._waiter                                                                                                                                                                                                               
aiohttp.client_exceptions.ClientOSError: [Errno None] Can not write request body for http://192.168.1.15/onvif/Media

* Add code comment

* Update camera.py

* Lint.
2019-11-25 17:56:17 -08:00
..
__init__.py
camera.py Fix Onvif setup error: premature end of connection on GetStreamURI (#26781) 2019-11-25 17:56:17 -08:00
manifest.json Update documentation link URL for integrations in all manifests (#27114) 2019-10-02 09:25:44 -07:00
services.yaml Add services.yaml to onvif component (#28349) 2019-10-31 18:57:00 +01:00