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
1 change: 1 addition & 0 deletions homeassistant/components/vizio/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ async def async_step_zeroconf(
await self.async_set_unique_id(
unique_id=discovery_info[CONF_HOST].split(":")[0], raise_on_progress=True
)
self._abort_if_unique_id_configured()

discovery_info[
CONF_HOST
Expand Down
1 change: 1 addition & 0 deletions tests/components/vizio/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ def __init__(self, auth_token: str) -> None:
CONF_INCLUDE_OR_EXCLUDE: CONF_INCLUDE.title(),
CONF_APPS_TO_INCLUDE_OR_EXCLUDE: [CURRENT_APP],
}

MOCK_INCLUDE_NO_APPS = {
CONF_INCLUDE_OR_EXCLUDE: CONF_INCLUDE.title(),
CONF_APPS_TO_INCLUDE_OR_EXCLUDE: [],
Expand Down
26 changes: 26 additions & 0 deletions tests/components/vizio/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
NAME2,
UNIQUE_ID,
VOLUME_STEP,
ZEROCONF_HOST,
)

from tests.common import MockConfigEntry
Expand Down Expand Up @@ -827,3 +828,28 @@ async def test_zeroconf_ignore(
)

assert result["type"] == data_entry_flow.RESULT_TYPE_FORM


async def test_zeroconf_abort_when_ignored(
hass: HomeAssistantType,
vizio_connect: pytest.fixture,
vizio_bypass_setup: pytest.fixture,
vizio_guess_device_type: pytest.fixture,
) -> None:
"""Test zeroconf discovery aborts when the same host has been ignored."""
entry = MockConfigEntry(
domain=DOMAIN,
data=MOCK_SPEAKER_CONFIG,
options={CONF_VOLUME_STEP: VOLUME_STEP},
source=SOURCE_IGNORE,
unique_id=ZEROCONF_HOST,
)
entry.add_to_hass(hass)

discovery_info = MOCK_ZEROCONF_SERVICE_INFO.copy()
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_ZEROCONF}, data=discovery_info
)

assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["reason"] == "already_configured"