mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Make deCONZ SSDP discovery more strict by matching on manufacturerURL (#71124)
This commit is contained in:
parent
e3f224e115
commit
a0fe5b0247
@ -215,12 +215,6 @@ class DeconzFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
async def async_step_ssdp(self, discovery_info: ssdp.SsdpServiceInfo) -> FlowResult:
|
||||
"""Handle a discovered deCONZ bridge."""
|
||||
if (
|
||||
discovery_info.upnp.get(ssdp.ATTR_UPNP_MANUFACTURER_URL)
|
||||
!= DECONZ_MANUFACTURERURL
|
||||
):
|
||||
return self.async_abort(reason="not_deconz_bridge")
|
||||
|
||||
LOGGER.debug("deCONZ SSDP discovery %s", pformat(discovery_info))
|
||||
|
||||
self.bridge_id = normalize_bridge_id(discovery_info.upnp[ssdp.ATTR_UPNP_SERIAL])
|
||||
|
@ -6,7 +6,8 @@
|
||||
"requirements": ["pydeconz==91"],
|
||||
"ssdp": [
|
||||
{
|
||||
"manufacturer": "Royal Philips Electronics"
|
||||
"manufacturer": "Royal Philips Electronics",
|
||||
"manufacturerURL": "http://www.dresden-elektronik.de"
|
||||
}
|
||||
],
|
||||
"codeowners": ["@Kane610"],
|
||||
|
@ -31,7 +31,6 @@
|
||||
"already_in_progress": "[%key:common::config_flow::abort::already_in_progress%]",
|
||||
"no_bridges": "No deCONZ bridges discovered",
|
||||
"no_hardware_available": "No radio hardware connected to deCONZ",
|
||||
"not_deconz_bridge": "Not a deCONZ bridge",
|
||||
"updated_instance": "Updated deCONZ instance with new host address"
|
||||
}
|
||||
},
|
||||
|
@ -24,7 +24,8 @@ SSDP = {
|
||||
],
|
||||
"deconz": [
|
||||
{
|
||||
"manufacturer": "Royal Philips Electronics"
|
||||
"manufacturer": "Royal Philips Electronics",
|
||||
"manufacturerURL": "http://www.dresden-elektronik.de"
|
||||
}
|
||||
],
|
||||
"denonavr": [
|
||||
|
@ -459,22 +459,6 @@ async def test_flow_ssdp_discovery(hass, aioclient_mock):
|
||||
}
|
||||
|
||||
|
||||
async def test_flow_ssdp_bad_discovery(hass, aioclient_mock):
|
||||
"""Test that SSDP discovery aborts if manufacturer URL is wrong."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DECONZ_DOMAIN,
|
||||
data=ssdp.SsdpServiceInfo(
|
||||
ssdp_usn="mock_usn",
|
||||
ssdp_st="mock_st",
|
||||
upnp={ATTR_UPNP_MANUFACTURER_URL: "other"},
|
||||
),
|
||||
context={"source": SOURCE_SSDP},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["reason"] == "not_deconz_bridge"
|
||||
|
||||
|
||||
async def test_ssdp_discovery_update_configuration(hass, aioclient_mock):
|
||||
"""Test if a discovered bridge is configured but updates with new attributes."""
|
||||
config_entry = await setup_deconz_integration(hass, aioclient_mock)
|
||||
|
Loading…
x
Reference in New Issue
Block a user