mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Allow creating deCONZ config entry even when no bridge id is available
This commit is contained in:
parent
f2f935506e
commit
a8f0ad1dd8
@ -172,9 +172,6 @@ class DeconzFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
except asyncio.TimeoutError:
|
||||
return self.async_abort(reason="no_bridges")
|
||||
|
||||
if self.bridge_id == "0000000000000000":
|
||||
return self.async_abort(reason="no_hardware_available")
|
||||
|
||||
return self.async_create_entry(title=self.bridge_id, data=self.deconz_config)
|
||||
|
||||
async def async_step_ssdp(self, discovery_info):
|
||||
|
@ -402,47 +402,6 @@ async def test_flow_ssdp_discovery(hass, aioclient_mock):
|
||||
}
|
||||
|
||||
|
||||
async def test_flow_ssdp_discovery_bad_bridge_id_aborts(hass, aioclient_mock):
|
||||
"""Test that config flow aborts if deCONZ signals no radio hardware available."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
data={
|
||||
ATTR_SSDP_LOCATION: "http://1.2.3.4:80/",
|
||||
ATTR_UPNP_MANUFACTURER_URL: DECONZ_MANUFACTURERURL,
|
||||
ATTR_UPNP_SERIAL: BAD_BRIDGEID,
|
||||
},
|
||||
context={"source": SOURCE_SSDP},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_FORM
|
||||
assert result["step_id"] == "link"
|
||||
|
||||
aioclient_mock.post(
|
||||
"http://1.2.3.4:80/api",
|
||||
json=[{"success": {"username": API_KEY}}],
|
||||
headers={"content-type": CONTENT_TYPE_JSON},
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["reason"] == "no_hardware_available"
|
||||
|
||||
|
||||
async def test_ssdp_discovery_not_deconz_bridge(hass):
|
||||
"""Test a non deconz bridge being discovered over ssdp."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
data={ATTR_UPNP_MANUFACTURER_URL: "not deconz bridge"},
|
||||
context={"source": SOURCE_SSDP},
|
||||
)
|
||||
|
||||
assert result["type"] == RESULT_TYPE_ABORT
|
||||
assert result["reason"] == "not_deconz_bridge"
|
||||
|
||||
|
||||
async def test_ssdp_discovery_update_configuration(hass):
|
||||
"""Test if a discovered bridge is configured but updates with new attributes."""
|
||||
config_entry = await setup_deconz_integration(hass)
|
||||
|
Loading…
x
Reference in New Issue
Block a user