Fix rachio not being able to be ignored (#78636)

Fixes #77272
This commit is contained in:
J. Nick Koston 2022-09-17 12:44:24 -05:00 committed by GitHub
parent 01acc3d1e5
commit 8cae33a730
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

View file

@ -90,6 +90,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
await self.async_set_unique_id( await self.async_set_unique_id(
discovery_info.properties[zeroconf.ATTR_PROPERTIES_ID] discovery_info.properties[zeroconf.ATTR_PROPERTIES_ID]
) )
self._abort_if_unique_id_configured()
return await self.async_step_user() return await self.async_step_user()
@staticmethod @staticmethod

View file

@ -149,3 +149,29 @@ async def test_form_homekit(hass):
) )
assert result["type"] == "abort" assert result["type"] == "abort"
assert result["reason"] == "already_configured" assert result["reason"] == "already_configured"
async def test_form_homekit_ignored(hass):
"""Test that we abort from homekit if rachio is ignored."""
entry = MockConfigEntry(
domain=DOMAIN,
unique_id="AA:BB:CC:DD:EE:FF",
source=config_entries.SOURCE_IGNORE,
)
entry.add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_HOMEKIT},
data=zeroconf.ZeroconfServiceInfo(
host="mock_host",
addresses=["mock_host"],
hostname="mock_hostname",
name="mock_name",
port=None,
properties={zeroconf.ATTR_PROPERTIES_ID: "AA:BB:CC:DD:EE:FF"},
type="mock_type",
),
)
assert result["type"] == "abort"
assert result["reason"] == "already_configured"