mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Fix ignoring elkm1 discovery (#68750)
This commit is contained in:
parent
67d3e84448
commit
aa7cb087a9
@ -166,6 +166,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
for progress in self._async_in_progress():
|
for progress in self._async_in_progress():
|
||||||
if progress.get("context", {}).get(CONF_HOST) == host:
|
if progress.get("context", {}).get(CONF_HOST) == host:
|
||||||
return self.async_abort(reason="already_in_progress")
|
return self.async_abort(reason="already_in_progress")
|
||||||
|
# Handled ignored case since _async_current_entries
|
||||||
|
# is called with include_ignore=False
|
||||||
|
self._abort_if_unique_id_configured()
|
||||||
if not device.port:
|
if not device.port:
|
||||||
if discovered_device := await async_discover_device(self.hass, host):
|
if discovered_device := await async_discover_device(self.hass, host):
|
||||||
self._discovered_device = discovered_device
|
self._discovered_device = discovered_device
|
||||||
|
@ -27,6 +27,27 @@ ELK_DISCOVERY_INFO = asdict(ELK_DISCOVERY)
|
|||||||
MODULE = "homeassistant.components.elkm1"
|
MODULE = "homeassistant.components.elkm1"
|
||||||
|
|
||||||
|
|
||||||
|
async def test_discovery_ignored_entry(hass):
|
||||||
|
"""Test we abort on ignored entry."""
|
||||||
|
config_entry = MockConfigEntry(
|
||||||
|
domain=DOMAIN,
|
||||||
|
data={CONF_HOST: f"elks://{MOCK_IP_ADDRESS}"},
|
||||||
|
unique_id="aa:bb:cc:dd:ee:ff",
|
||||||
|
source=config_entries.SOURCE_IGNORE,
|
||||||
|
)
|
||||||
|
config_entry.add_to_hass(hass)
|
||||||
|
|
||||||
|
with _patch_discovery(), _patch_elk():
|
||||||
|
result = await hass.config_entries.flow.async_init(
|
||||||
|
DOMAIN,
|
||||||
|
context={"source": config_entries.SOURCE_INTEGRATION_DISCOVERY},
|
||||||
|
data=ELK_DISCOVERY_INFO,
|
||||||
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
assert result["type"] == RESULT_TYPE_ABORT
|
||||||
|
assert result["reason"] == "already_configured"
|
||||||
|
|
||||||
|
|
||||||
async def test_form_user_with_secure_elk_no_discovery(hass):
|
async def test_form_user_with_secure_elk_no_discovery(hass):
|
||||||
"""Test we can setup a secure elk."""
|
"""Test we can setup a secure elk."""
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user