mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 05:47:10 +00:00
Use dataclass properties in nanoleaf discovery (#60580)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
8a9f197918
commit
be89c07cac
@ -106,20 +106,18 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
) -> FlowResult:
|
) -> FlowResult:
|
||||||
"""Handle Nanoleaf Homekit and Zeroconf discovery."""
|
"""Handle Nanoleaf Homekit and Zeroconf discovery."""
|
||||||
return await self._async_discovery_handler(
|
return await self._async_discovery_handler(
|
||||||
discovery_info[zeroconf.ATTR_HOST],
|
discovery_info.host,
|
||||||
discovery_info[zeroconf.ATTR_NAME].replace(
|
discovery_info.name.replace(f".{discovery_info.type}", ""),
|
||||||
f".{discovery_info[zeroconf.ATTR_TYPE]}", ""
|
discovery_info.properties[zeroconf.ATTR_PROPERTIES_ID],
|
||||||
),
|
|
||||||
discovery_info[zeroconf.ATTR_PROPERTIES][zeroconf.ATTR_PROPERTIES_ID],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_step_ssdp(self, discovery_info: ssdp.SsdpServiceInfo) -> FlowResult:
|
async def async_step_ssdp(self, discovery_info: ssdp.SsdpServiceInfo) -> FlowResult:
|
||||||
"""Handle Nanoleaf SSDP discovery."""
|
"""Handle Nanoleaf SSDP discovery."""
|
||||||
_LOGGER.debug("SSDP discovered: %s", discovery_info)
|
_LOGGER.debug("SSDP discovered: %s", discovery_info)
|
||||||
return await self._async_discovery_handler(
|
return await self._async_discovery_handler(
|
||||||
discovery_info["_host"],
|
discovery_info.ssdp_headers["_host"],
|
||||||
discovery_info["nl-devicename"],
|
discovery_info.ssdp_headers["nl-devicename"],
|
||||||
discovery_info["nl-deviceid"],
|
discovery_info.ssdp_headers["nl-deviceid"],
|
||||||
)
|
)
|
||||||
|
|
||||||
async def _async_discovery_handler(
|
async def _async_discovery_handler(
|
||||||
|
@ -465,7 +465,8 @@ async def test_ssdp_discovery(hass: HomeAssistant) -> None:
|
|||||||
data=ssdp.SsdpServiceInfo(
|
data=ssdp.SsdpServiceInfo(
|
||||||
ssdp_usn="mock_usn",
|
ssdp_usn="mock_usn",
|
||||||
ssdp_st="mock_st",
|
ssdp_st="mock_st",
|
||||||
upnp={
|
upnp={},
|
||||||
|
ssdp_headers={
|
||||||
"_host": TEST_HOST,
|
"_host": TEST_HOST,
|
||||||
"nl-devicename": TEST_NAME,
|
"nl-devicename": TEST_NAME,
|
||||||
"nl-deviceid": TEST_DEVICE_ID,
|
"nl-deviceid": TEST_DEVICE_ID,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user