* onvif: encode username password in url
Signed-off-by: Xuefer <xuefer@gmail.com>
* onvif: use yarl to set username password for steam url
Signed-off-by: Xuefer <xuefer@gmail.com>
* fallback to device serial number if no mac available
* make password optional to fix#35904
* update tests to reflect new flow
* fix snake case and AsyncMock
* add comments around why weird things are being done
* specify rtsp_transport for onvif camera
* remove used variable
* Update homeassistant/components/stream/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* change options to stream_options
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Adding support for PTZ move modes
Adding support for other PTZ move modes.
Onvif intergration used to only support RelativeMove where it should also supports AbsoluteMove, ContinuousMove and Stop.
For exemple Goke GK7102 based IP camera only support ContinuousMove mode.
This commit add those new modes with avaibility to select mode and params in service call.
* Adding support for PTZ move modes
Adding support for other PTZ move modes.
Onvif intergration used to only support RelativeMove where it should also supports AbsoluteMove, ContinuousMove and Stop.
For exemple Goke GK7102 based IP camera only support ContinuousMove mode.
Update service helper for new avaibility to select mode and params in service call.
* RelativeMode as default move_mode to avoid breakchange
RelativeMode as default move_mode to avoid breakchange
* add missing attribute
add missing continuous_duration attribute
* change service attribute label for continuous_duration
* update description
fix wrong assertion for move_mode attr description
* Update services.yaml
* Update services.yaml
fix wrong wording for move_mode
* Update camera.py
Using defined constants instead of raw strings in conditions
* Update camera.py
Replace integer to floating point in logger debug PTZ values
* Update services.yaml
* Update services.yaml
* Update camera.py
* Update camera.py
* use dict[key] for required schema keys and keys with default schema values
* remove async for setup_ptz method
* lint error
* remove unecessary PTZ_NONE = "NONE"
changed request by @MartinHjelmare
* addressing @ MartinHjelmare comments
- Remove None in defaluts and dicts
- Replace long if blocks
* remove NONE
* lint issue
* Update camera.py
* Fix lint error - typo
* rename onvif_ptz service to just ptz
* rename onvif_ptz service to just ptz
* use dict[key] when default values are set
use service.data[key] instead of service.data.get[key] when default value is set in service schema
* adresse comment: use dict[key] for pan tilt zoom
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* 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.
* Onvif camera improvements using zeep
* Fix static code checks
* Make obtain_input_uri async
* Convert several methods to async
* Fix static checks
* Fix static checks
* Fix requirements_all.txt
* Lint improvements
* Async services
* Use onvif-zeep-async and check if PTZ service is available before creating it
* Remove some hacks that are now defined in onvif-zeep-async
* Don't log input, it might contain sensitive information
* Static code analysis fixes
* Run requirements stuff
* Fix
* Remove suds requirement
* Onvif camera improvements using zeep
* Fix static code checks
* Make obtain_input_uri async
* Convert several methods to async
* Fix static checks
* Fix static checks
* Fix requirements_all.txt
* Lint improvements
* Async services
* Use onvif-zeep-async and check if PTZ service is available before creating it
* Remove some hacks that are now defined in onvif-zeep-async
* Don't log input, it might contain sensitive information
* Static code analysis fixes
* Run requirements stuff
* Fix
* Remove suds requirement
* Use dt_util.utcnow
* Platform setup should not have a return value
* Remove explicit dependency to zeep[async]
* Bump onvif-zeep-async to 0.1.2
* Update requirements_all.txt
* Add exception handling
* Fix static checks
* Don't catch generic exceptions
* Update camera.py
* Update Onvif component to SUPPORT_STREAM
* Update camera.py
* Update camera.py
* Update camera.py
Remove extra spaces.
* lookup URL when camera is added to hass and add extra guards
* initial commit for camera preferences and preload stream
* cleanup and add tests
* respect camera preferences on each request stream call
* return the new prefs after update
* Consolidate
* Fix tests
* Update imports
* Fix import
* Use importlib because integration and package share name
* Fix more tests
* Update .coveragerc and CODEOWNERS