Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions homeassistant/components/nanoleaf/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,18 @@ async def _async_homekit_zeroconf_discovery_handler(
) -> FlowResult:
"""Handle Nanoleaf Homekit and Zeroconf discovery."""
return await self._async_discovery_handler(
discovery_info[zeroconf.ATTR_HOST],
discovery_info[zeroconf.ATTR_NAME].replace(
f".{discovery_info[zeroconf.ATTR_TYPE]}", ""
),
discovery_info[zeroconf.ATTR_PROPERTIES][zeroconf.ATTR_PROPERTIES_ID],
discovery_info.host,
discovery_info.name.replace(f".{discovery_info.type}", ""),
discovery_info.properties[zeroconf.ATTR_PROPERTIES_ID],
)

async def async_step_ssdp(self, discovery_info: ssdp.SsdpServiceInfo) -> FlowResult:
"""Handle Nanoleaf SSDP discovery."""
_LOGGER.debug("SSDP discovered: %s", discovery_info)
return await self._async_discovery_handler(
discovery_info["_host"],
discovery_info["nl-devicename"],
discovery_info["nl-deviceid"],
discovery_info.ssdp_headers["_host"],
discovery_info.ssdp_headers["nl-devicename"],
discovery_info.ssdp_headers["nl-deviceid"],
)

async def _async_discovery_handler(
Expand Down
3 changes: 2 additions & 1 deletion tests/components/nanoleaf/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ async def test_ssdp_discovery(hass: HomeAssistant) -> None:
data=ssdp.SsdpServiceInfo(
ssdp_usn="mock_usn",
ssdp_st="mock_st",
upnp={
upnp={},
ssdp_headers={
"_host": TEST_HOST,
"nl-devicename": TEST_NAME,
"nl-deviceid": TEST_DEVICE_ID,
Expand Down