Skip to content

Commit de042d8

Browse files
committed
Revert "Only enable WSAs for events/notify/pullpoint services (#31)"
This reverts commit a8e3385.
1 parent 6e4d3bb commit de042d8

File tree

1 file changed

+10
-39
lines changed

1 file changed

+10
-39
lines changed

onvif/client.py

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ def __init__(
252252
binding_key="",
253253
read_timeout: Optional[int] = None,
254254
write_timeout: Optional[int] = None,
255-
enable_wsa: bool = False,
256255
) -> None:
257256
if not _path_isfile(url):
258257
raise ONVIFError("%s doesn`t exist!" % url)
@@ -297,7 +296,6 @@ def __init__(
297296
self.ws_client: Optional[AsyncServiceProxy] = None
298297
self.create_type: Optional[Callable] = None
299298
self.loop = asyncio.get_event_loop()
300-
self._enable_wsa = enable_wsa
301299

302300
async def setup(self):
303301
"""Setup the transport."""
@@ -309,15 +307,11 @@ async def setup(self):
309307
self.document = await self.loop.run_in_executor(
310308
None, _cached_document, self.url
311309
)
312-
# Some cameras never return a response to GetCapabilities if WS-Addressing is enabled
313-
# but some cameras require WS-Addressing to be enabled for PullPoint or events to work
314-
# so we have a flag to enable/disable it which can be changed per service.
315-
plugins = [WsAddressingPlugin()] if self._enable_wsa else []
316310
self.zeep_client_authless = ZeepAsyncClient(
317311
wsdl=self.document,
318312
transport=self.transport,
319313
settings=settings,
320-
plugins=plugins,
314+
plugins=[WsAddressingPlugin()],
321315
)
322316
self.ws_client_authless = self.zeep_client_authless.create_service(
323317
binding_name, self.xaddr
@@ -327,7 +321,7 @@ async def setup(self):
327321
wsse=wsse,
328322
transport=self.transport,
329323
settings=settings,
330-
plugins=plugins,
324+
plugins=[WsAddressingPlugin()],
331325
)
332326
self.ws_client = self.zeep_client.create_service(binding_name, self.xaddr)
333327
namespace = binding_name[binding_name.find("{") + 1 : binding_name.find("}")]
@@ -410,10 +404,8 @@ async def setup(self) -> ONVIFService:
410404
#
411405
# If this fails this is OK as it just means we will switch
412406
# to webhook later when the first notification is received.
413-
# WSAs enabled per
414-
# https://github.com/home-assistant/core/issues/83524 https://github.com/home-assistant/core/issues/45513
415407
service = await self._device.create_onvif_service(
416-
"pullpoint", port_type="NotificationConsumer", enable_wsa=True
408+
"pullpoint", port_type="NotificationConsumer"
417409
)
418410
self._operation = service.document.bindings[service.binding_name].get(
419411
"PullMessages"
@@ -657,7 +649,6 @@ async def create_onvif_service(
657649
port_type: Optional[str] = None,
658650
read_timeout: Optional[int] = None,
659651
write_timeout: Optional[int] = None,
660-
enable_wsa: bool = False,
661652
) -> ONVIFService:
662653
"""Create ONVIF service client"""
663654
name = name.lower()
@@ -696,7 +687,6 @@ async def create_onvif_service(
696687
binding_key=binding_key,
697688
read_timeout=read_timeout,
698689
write_timeout=write_timeout,
699-
enable_wsa=enable_wsa,
700690
)
701691
await service.setup()
702692

@@ -725,12 +715,8 @@ async def create_deviceio_service(self) -> ONVIFService:
725715
return await self.create_onvif_service("deviceio")
726716

727717
async def create_events_service(self) -> ONVIFService:
728-
"""Service creation helper.
729-
730-
WSAs enabled per
731-
https://github.com/home-assistant/core/issues/83524 https://github.com/home-assistant/core/issues/45513
732-
"""
733-
return await self.create_onvif_service("events", enable_wsa=True)
718+
"""Service creation helper."""
719+
return await self.create_onvif_service("events")
734720

735721
async def create_analytics_service(self) -> ONVIFService:
736722
"""Service creation helper."""
@@ -749,38 +735,23 @@ async def create_replay_service(self) -> ONVIFService:
749735
return await self.create_onvif_service("replay")
750736

751737
async def create_pullpoint_service(self) -> ONVIFService:
752-
"""Service creation helper.
753-
754-
WSAs enabled per
755-
https://github.com/home-assistant/core/issues/83524 https://github.com/home-assistant/core/issues/45513
756-
"""
738+
"""Service creation helper."""
757739
return await self.create_onvif_service(
758740
"pullpoint",
759741
port_type="PullPointSubscription",
760742
read_timeout=_PULLPOINT_TIMEOUT,
761743
write_timeout=_PULLPOINT_TIMEOUT,
762-
enable_wsa=True,
763744
)
764745

765746
async def create_notification_service(self) -> ONVIFService:
766-
"""Service creation helper.
767-
768-
WSAs enabled per
769-
https://github.com/home-assistant/core/issues/83524 https://github.com/home-assistant/core/issues/45513
770-
"""
771-
return await self.create_onvif_service("notification", enable_wsa=True)
747+
"""Service creation helper."""
748+
return await self.create_onvif_service("notification")
772749

773750
async def create_subscription_service(
774751
self, port_type: Optional[str] = None
775752
) -> ONVIFService:
776-
"""Service creation helper.
777-
778-
WSAs enabled per
779-
https://github.com/home-assistant/core/issues/83524 https://github.com/home-assistant/core/issues/45513
780-
"""
781-
return await self.create_onvif_service(
782-
"subscription", port_type=port_type, enable_wsa=True
783-
)
753+
"""Service creation helper."""
754+
return await self.create_onvif_service("subscription", port_type=port_type)
784755

785756
async def create_receiver_service(self) -> ONVIFService:
786757
"""Service creation helper."""

0 commit comments

Comments
 (0)