Bump WSDiscovery to 2.1.2 (#136363)

This commit is contained in:
J. Nick Koston 2025-01-23 23:30:49 -10:00 committed by GitHub
parent 5a30156372
commit 0abdda7abb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 7 deletions

View File

@ -11,6 +11,7 @@ from urllib.parse import urlparse
from onvif.util import is_auth_error, stringify_onvif_error from onvif.util import is_auth_error, stringify_onvif_error
import voluptuous as vol import voluptuous as vol
from wsdiscovery.discovery import ThreadedWSDiscovery as WSDiscovery from wsdiscovery.discovery import ThreadedWSDiscovery as WSDiscovery
from wsdiscovery.qname import QName
from wsdiscovery.scope import Scope from wsdiscovery.scope import Scope
from wsdiscovery.service import Service from wsdiscovery.service import Service
from zeep.exceptions import Fault from zeep.exceptions import Fault
@ -58,16 +59,22 @@ CONF_MANUAL_INPUT = "Manually configure ONVIF device"
def wsdiscovery() -> list[Service]: def wsdiscovery() -> list[Service]:
"""Get ONVIF Profile S devices from network.""" """Get ONVIF Profile S devices from network."""
discovery = WSDiscovery(ttl=4) discovery = WSDiscovery(ttl=4, relates_to=True)
try: try:
discovery.start() discovery.start()
return discovery.searchServices( return discovery.searchServices(
scopes=[Scope("onvif://www.onvif.org/Profile/Streaming")] types=[
QName(
"http://www.onvif.org/ver10/network/wsdl",
"NetworkVideoTransmitter",
"dp0",
)
],
scopes=[Scope("onvif://www.onvif.org/Profile/Streaming")],
timeout=10,
) )
finally: finally:
discovery.stop() discovery.stop()
# Stop the threads started by WSDiscovery since otherwise there is a leak.
discovery._stopThreads() # noqa: SLF001
async def async_discovery(hass: HomeAssistant) -> list[dict[str, Any]]: async def async_discovery(hass: HomeAssistant) -> list[dict[str, Any]]:

View File

@ -8,5 +8,5 @@
"documentation": "https://www.home-assistant.io/integrations/onvif", "documentation": "https://www.home-assistant.io/integrations/onvif",
"iot_class": "local_push", "iot_class": "local_push",
"loggers": ["onvif", "wsdiscovery", "zeep"], "loggers": ["onvif", "wsdiscovery", "zeep"],
"requirements": ["onvif-zeep-async==3.2.5", "WSDiscovery==2.0.0"] "requirements": ["onvif-zeep-async==3.2.5", "WSDiscovery==2.1.2"]
} }

2
requirements_all.txt generated
View File

@ -128,7 +128,7 @@ TravisPy==0.3.5
TwitterAPI==2.7.12 TwitterAPI==2.7.12
# homeassistant.components.onvif # homeassistant.components.onvif
WSDiscovery==2.0.0 WSDiscovery==2.1.2
# homeassistant.components.accuweather # homeassistant.components.accuweather
accuweather==4.0.0 accuweather==4.0.0

View File

@ -116,7 +116,7 @@ SQLAlchemy==2.0.36
Tami4EdgeAPI==3.0 Tami4EdgeAPI==3.0
# homeassistant.components.onvif # homeassistant.components.onvif
WSDiscovery==2.0.0 WSDiscovery==2.1.2
# homeassistant.components.accuweather # homeassistant.components.accuweather
accuweather==4.0.0 accuweather==4.0.0