mirror of
https://github.com/home-assistant/core.git
synced 2025-06-25 01:21:51 +02:00
Bump WSDiscovery to 2.1.2 (#136363)
This commit is contained in:
@ -11,6 +11,7 @@ from urllib.parse import urlparse
|
||||
from onvif.util import is_auth_error, stringify_onvif_error
|
||||
import voluptuous as vol
|
||||
from wsdiscovery.discovery import ThreadedWSDiscovery as WSDiscovery
|
||||
from wsdiscovery.qname import QName
|
||||
from wsdiscovery.scope import Scope
|
||||
from wsdiscovery.service import Service
|
||||
from zeep.exceptions import Fault
|
||||
@ -58,16 +59,22 @@ CONF_MANUAL_INPUT = "Manually configure ONVIF device"
|
||||
|
||||
def wsdiscovery() -> list[Service]:
|
||||
"""Get ONVIF Profile S devices from network."""
|
||||
discovery = WSDiscovery(ttl=4)
|
||||
discovery = WSDiscovery(ttl=4, relates_to=True)
|
||||
try:
|
||||
discovery.start()
|
||||
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:
|
||||
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]]:
|
||||
|
@ -8,5 +8,5 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/onvif",
|
||||
"iot_class": "local_push",
|
||||
"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
2
requirements_all.txt
generated
@ -128,7 +128,7 @@ TravisPy==0.3.5
|
||||
TwitterAPI==2.7.12
|
||||
|
||||
# homeassistant.components.onvif
|
||||
WSDiscovery==2.0.0
|
||||
WSDiscovery==2.1.2
|
||||
|
||||
# homeassistant.components.accuweather
|
||||
accuweather==4.0.0
|
||||
|
2
requirements_test_all.txt
generated
2
requirements_test_all.txt
generated
@ -116,7 +116,7 @@ SQLAlchemy==2.0.36
|
||||
Tami4EdgeAPI==3.0
|
||||
|
||||
# homeassistant.components.onvif
|
||||
WSDiscovery==2.0.0
|
||||
WSDiscovery==2.1.2
|
||||
|
||||
# homeassistant.components.accuweather
|
||||
accuweather==4.0.0
|
||||
|
Reference in New Issue
Block a user