Invalid ONVIF SubscriptionManager RenewRequest - python-zeep WSA bug
See original GitHub issueThe problem
The problem is missing addressing in the SubscriptionManager/RenewRequest.
The Header contains only the Security element.
Action
, To
and MessageID
are missing in the Header of the Renew request.
As the result a lot of ONVIF cameras (XiongMai, Wanscam and other) response 400 (Bad Request) to RenewRequest.
It is impossible to add/setup these cameras at all.
You can see different errors in logs, but the reason is the same.
My patch to python-zeep
which fixed this issue was reverted. So it must be fixed in Home Assistant code.
Environment
- Home Assistant Core release with the issue: 2021.1.5
- Last working Home Assistant Core release (if known): never
- Operating environment (OS/Container/Supervised/Core): Supervised
- Integration causing this issue: ONVIF
- Link to integration documentation on our website: https://www.home-assistant.io/integrations/onvif
Problem-relevant configuration.yaml
logger:
default: info
logs:
homeassistant.components.onvif: debug
Traceback/Error logs
2021-01-25 03:57:41 DEBUG (MainThread) [homeassistant.components.onvif] Setting up the ONVIF device management service
2021-01-25 03:57:41 DEBUG (MainThread) [homeassistant.components.onvif] Retrieving current device date/time
2021-01-25 03:57:41 DEBUG (MainThread) [homeassistant.components.onvif] Device date/time: 2021-01-24 23:57:42+00:00 | System date/time: 2021-01-24 23:57:41.482773+00:00
2021-01-25 03:57:44 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Cam1 - xx:xx:xx:xx:xx:xx for onvif
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 236, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/usr/src/homeassistant/homeassistant/components/onvif/__init__.py", line 77, in async_setup_entry
if not await device.async_setup():
File "/usr/src/homeassistant/homeassistant/components/onvif/device.py", line 105, in async_setup
self.capabilities = await self.async_get_capabilities()
File "/usr/src/homeassistant/homeassistant/components/onvif/device.py", line 252, in async_get_capabilities
pullpoint = await self.events.async_start()
File "/usr/src/homeassistant/homeassistant/components/onvif/event.py", line 83, in async_start
await self.async_renew()
File "/usr/src/homeassistant/homeassistant/components/onvif/event.py", line 154, in async_renew
await self._subscription.Renew(termination_time)
File "/usr/local/lib/python3.8/site-packages/zeep/proxy.py", line 64, in __call__
return await self._proxy._binding.send_async(
File "/usr/local/lib/python3.8/site-packages/zeep/wsdl/bindings/soap.py", line 164, in send_async
return self.process_reply(client, operation_obj, response)
File "/usr/local/lib/python3.8/site-packages/zeep/wsdl/bindings/soap.py", line 229, in process_reply
return self.process_error(doc, operation)
File "/usr/local/lib/python3.8/site-packages/zeep/wsdl/bindings/soap.py", line 381, in process_error
subcode_qname = as_qname(
File "/usr/local/lib/python3.8/site-packages/zeep/utils.py", line 36, in as_qname
raise XMLParseError("No namespace defined for %r (%r)" % (prefix, value))
zeep.exceptions.XMLParseError: No namespace defined for 'ter' ('ter:InvalidArgVal')
Additional information
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:30
Top Results From Across the Web
How to execute ContinuousMove with python zeep for onvif ...
I was trying to execute onvif commands using python3 zeep package and got most of the commands working. But as I'm new and...
Read more >The python-onvif from quatanium - Coder Social
onvif client implementation in python from coder social. ... Type instance will raise an exception if you set an invalid (or non-existent) parameter....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Zeep 4.1.0 has been released yesterday. This patch was merged and reverted immediately with the following comment:
It means that this issue must be fixed in ONVIF integration which is a part of Home Assistant Core.
https://github.com/slydiman/ha_custom_onvif Any comments/improvements are welcome.