mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Bump async-upnp-client to 0.20.0, adapt to breaking changes (#54782)
This commit is contained in:
parent
c937a235e1
commit
62015f5495
@ -2,7 +2,7 @@
|
||||
"domain": "dlna_dmr",
|
||||
"name": "DLNA Digital Media Renderer",
|
||||
"documentation": "https://www.home-assistant.io/integrations/dlna_dmr",
|
||||
"requirements": ["async-upnp-client==0.19.2"],
|
||||
"requirements": ["async-upnp-client==0.20.0"],
|
||||
"dependencies": ["network"],
|
||||
"codeowners": [],
|
||||
"iot_class": "local_push"
|
||||
|
@ -223,25 +223,17 @@ class Scanner:
|
||||
|
||||
return sources
|
||||
|
||||
@core_callback
|
||||
def async_scan(self, *_: Any) -> None:
|
||||
"""Scan for new entries."""
|
||||
async def async_scan(self, *_: Any) -> None:
|
||||
"""Scan for new entries using ssdp default and broadcast target."""
|
||||
for listener in self._ssdp_listeners:
|
||||
listener.async_search()
|
||||
|
||||
self.async_scan_broadcast()
|
||||
|
||||
@core_callback
|
||||
def async_scan_broadcast(self, *_: Any) -> None:
|
||||
"""Scan for new entries using broadcast target."""
|
||||
# Some sonos devices only seem to respond if we send to the broadcast
|
||||
# address. This matches pysonos' behavior
|
||||
# https://github.com/amelchio/pysonos/blob/d4329b4abb657d106394ae69357805269708c996/pysonos/discovery.py#L120
|
||||
for listener in self._ssdp_listeners:
|
||||
try:
|
||||
IPv4Address(listener.source_ip)
|
||||
except ValueError:
|
||||
continue
|
||||
# Some sonos devices only seem to respond if we send to the broadcast
|
||||
# address. This matches pysonos' behavior
|
||||
# https://github.com/amelchio/pysonos/blob/d4329b4abb657d106394ae69357805269708c996/pysonos/discovery.py#L120
|
||||
listener.async_search((str(IPV4_BROADCAST), SSDP_PORT))
|
||||
|
||||
async def async_start(self) -> None:
|
||||
@ -251,7 +243,9 @@ class Scanner:
|
||||
for source_ip in await self._async_build_source_set():
|
||||
self._ssdp_listeners.append(
|
||||
SSDPListener(
|
||||
async_callback=self._async_process_entry, source_ip=source_ip
|
||||
async_connect_callback=self.async_scan,
|
||||
async_callback=self._async_process_entry,
|
||||
source_ip=source_ip,
|
||||
)
|
||||
)
|
||||
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self.async_stop)
|
||||
@ -277,10 +271,6 @@ class Scanner:
|
||||
self.hass, self.async_scan, SCAN_INTERVAL
|
||||
)
|
||||
|
||||
# Trigger a broadcast-scan. Regular scan is implicitly triggered
|
||||
# by SSDPListener.
|
||||
self.async_scan_broadcast()
|
||||
|
||||
@core_callback
|
||||
def _async_get_matching_callbacks(
|
||||
self, headers: Mapping[str, str]
|
||||
|
@ -4,7 +4,7 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/ssdp",
|
||||
"requirements": [
|
||||
"defusedxml==0.7.1",
|
||||
"async-upnp-client==0.19.2"
|
||||
"async-upnp-client==0.20.0"
|
||||
],
|
||||
"dependencies": ["network"],
|
||||
"after_dependencies": ["zeroconf"],
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "UPnP/IGD",
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/upnp",
|
||||
"requirements": ["async-upnp-client==0.19.2"],
|
||||
"requirements": ["async-upnp-client==0.20.0"],
|
||||
"dependencies": ["network", "ssdp"],
|
||||
"codeowners": ["@StevenLooman","@ehendrix23"],
|
||||
"ssdp": [
|
||||
|
@ -4,7 +4,7 @@ aiodiscover==1.4.2
|
||||
aiohttp==3.7.4.post0
|
||||
aiohttp_cors==0.7.0
|
||||
astral==2.2
|
||||
async-upnp-client==0.19.2
|
||||
async-upnp-client==0.20.0
|
||||
async_timeout==3.0.1
|
||||
attrs==21.2.0
|
||||
awesomeversion==21.4.0
|
||||
|
@ -314,7 +314,7 @@ asterisk_mbox==0.5.0
|
||||
# homeassistant.components.dlna_dmr
|
||||
# homeassistant.components.ssdp
|
||||
# homeassistant.components.upnp
|
||||
async-upnp-client==0.19.2
|
||||
async-upnp-client==0.20.0
|
||||
|
||||
# homeassistant.components.supla
|
||||
asyncpysupla==0.0.5
|
||||
|
@ -205,7 +205,7 @@ arcam-fmj==0.7.0
|
||||
# homeassistant.components.dlna_dmr
|
||||
# homeassistant.components.ssdp
|
||||
# homeassistant.components.upnp
|
||||
async-upnp-client==0.19.2
|
||||
async-upnp-client==0.20.0
|
||||
|
||||
# homeassistant.components.aurora
|
||||
auroranoaa==0.0.2
|
||||
|
@ -305,8 +305,8 @@ async def test_start_stop_scanner(
|
||||
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=200))
|
||||
await hass.async_block_till_done()
|
||||
assert async_start_mock.call_count == 1
|
||||
# Next is 3, as async_upnp_client triggers 1 SSDPListener._async_on_connect
|
||||
assert async_search_mock.call_count == 3
|
||||
# Next is 2, as async_upnp_client triggers 1 SSDPListener._async_on_connect
|
||||
assert async_search_mock.call_count == 2
|
||||
assert async_stop_mock.call_count == 0
|
||||
|
||||
hass.bus.async_fire(EVENT_HOMEASSISTANT_STOP)
|
||||
@ -314,7 +314,7 @@ async def test_start_stop_scanner(
|
||||
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=200))
|
||||
await hass.async_block_till_done()
|
||||
assert async_start_mock.call_count == 1
|
||||
assert async_search_mock.call_count == 3
|
||||
assert async_search_mock.call_count == 2
|
||||
assert async_stop_mock.call_count == 1
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user