Use new SsdpServiceInfo location in remaining components (#136053)

pull/135859/merge
epenet 2025-01-20 11:40:00 +01:00 committed by GitHub
parent 877e44e3c9
commit f7f6c1163d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 8 deletions

View File

@ -33,6 +33,7 @@ from homeassistant.const import CONF_DEVICE_ID, CONF_MAC, CONF_TYPE, CONF_URL
from homeassistant.core import CoreState, HomeAssistant
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.service_info.ssdp import SsdpServiceInfo
from .const import (
CONF_BROWSE_UNFILTERED,
@ -246,7 +247,7 @@ class DlnaDmrEntity(MediaPlayerEntity):
await self._device_disconnect()
async def async_ssdp_callback(
self, info: ssdp.SsdpServiceInfo, change: ssdp.SsdpChange
self, info: SsdpServiceInfo, change: ssdp.SsdpChange
) -> None:
"""Handle notification from SSDP of device state change."""
_LOGGER.debug(

View File

@ -29,6 +29,7 @@ from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_DEVICE_ID, CONF_URL
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import aiohttp_client
from homeassistant.helpers.service_info.ssdp import SsdpServiceInfo
from .const import (
CONF_SOURCE_ID,
@ -220,7 +221,7 @@ class DmsDeviceSource:
await self.device_disconnect()
async def async_ssdp_callback(
self, info: ssdp.SsdpServiceInfo, change: ssdp.SsdpChange
self, info: SsdpServiceInfo, change: ssdp.SsdpChange
) -> None:
"""Handle notification from SSDP of device state change."""
LOGGER.debug(

View File

@ -34,6 +34,7 @@ from homeassistant.helpers import (
)
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.event import async_call_later, async_track_time_interval
from homeassistant.helpers.service_info.ssdp import SsdpServiceInfo
from homeassistant.helpers.typing import ConfigType
from homeassistant.util.async_ import create_eager_task
@ -500,7 +501,7 @@ class SonosDiscoveryManager:
@callback
def _async_ssdp_discovered_player(
self, info: ssdp.SsdpServiceInfo, change: ssdp.SsdpChange
self, info: SsdpServiceInfo, change: ssdp.SsdpChange
) -> None:
uid = info.upnp[ssdp.ATTR_UPNP_UDN]
if not uid.startswith("uuid:RINCON_"):
@ -529,7 +530,7 @@ class SonosDiscoveryManager:
def async_discovered_player(
self,
source: str,
info: ssdp.SsdpServiceInfo,
info: SsdpServiceInfo,
discovered_ip: str,
uid: str,
boot_seqnum: str | int | None,

View File

@ -13,6 +13,7 @@ from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.service_info.ssdp import SsdpServiceInfo
from .const import (
CONFIG_ENTRY_FORCE_POLL,
@ -49,10 +50,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: UpnpConfigEntry) -> bool
# Register device discovered-callback.
device_discovered_event = asyncio.Event()
discovery_info: ssdp.SsdpServiceInfo | None = None
discovery_info: SsdpServiceInfo | None = None
async def device_discovered(
headers: ssdp.SsdpServiceInfo, change: ssdp.SsdpChange
headers: SsdpServiceInfo, change: ssdp.SsdpChange
) -> None:
if change == ssdp.SsdpChange.BYEBYE:
return

View File

@ -16,10 +16,11 @@ from async_upnp_client.search import SsdpSearchListener
from async_upnp_client.utils import CaseInsensitiveDict
from homeassistant import config_entries
from homeassistant.components import network, ssdp
from homeassistant.components import network
from homeassistant.core import CALLBACK_TYPE, HassJob, HomeAssistant, callback
from homeassistant.helpers import discovery_flow
from homeassistant.helpers.event import async_call_later, async_track_time_interval
from homeassistant.helpers.service_info.ssdp import SsdpServiceInfo
from homeassistant.util.async_ import create_eager_task
from .const import (
@ -171,7 +172,7 @@ class YeelightScanner:
self._hass,
DOMAIN,
context={"source": config_entries.SOURCE_SSDP},
data=ssdp.SsdpServiceInfo(
data=SsdpServiceInfo(
ssdp_usn="",
ssdp_st=SSDP_ST,
ssdp_headers=response,