core/homeassistant
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
..
auth Lint exclusions (#28655) 2019-11-16 10:22:07 +01:00
components Fix Onvif setup error: premature end of connection on GetStreamURI (#26781) 2019-11-25 17:56:17 -08:00
generated GeoNet NZ Volcanic Alert Level sensor (#26901) 2019-11-19 14:00:59 +01:00
helpers Add round to half template method (#28948) 2019-11-22 10:08:41 -08:00
scripts Bump keyring to 19.2.0 (#27899) 2019-10-18 20:09:41 -05:00
util fix typo for mediumvioletred (#28941) 2019-11-22 15:33:53 +01:00
__init__.py
__main__.py
bootstrap.py Add cloud account linking support (#28210) 2019-10-25 16:04:24 -07:00
config.py Fix documentation URL in failed platform config check (#28814) 2019-11-19 18:33:09 +01:00
config_entries.py Add source constants for all config entry discovery sources (#28311) 2019-10-28 23:32:57 -07:00
const.py Add broadcast_address for wake-on-lan (#28793) 2019-11-17 12:52:33 +01:00
core.py Lint exclusions (#28655) 2019-11-16 10:22:07 +01:00
data_entry_flow.py Type hint improvements (#28260) 2019-10-28 13:36:26 -07:00
exceptions.py Lint exclusions (#28655) 2019-11-16 10:22:07 +01:00
loader.py Lint exclusions (#28655) 2019-11-16 10:22:07 +01:00
monkey_patch.py Lint exclusions (#28655) 2019-11-16 10:22:07 +01:00
package_constraints.txt Upgrade zeroconf to 0.24.0 (#28986) 2019-11-23 23:11:01 +01:00
requirements.py Also install after_deps (#28453) 2019-11-01 17:21:50 -07:00
setup.py Check for import errors before validating config (#28395) 2019-10-31 11:38:06 -07:00