Fix ignored Axis config entries doesn't break set up of new entries (#44062)

This commit is contained in:
Robert Svensson 2020-12-09 17:48:16 +01:00 committed by GitHub
parent dd0afc3b66
commit 20c3fdfe14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -5,6 +5,7 @@ from ipaddress import ip_address
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries import SOURCE_IGNORE
from homeassistant.const import (
CONF_HOST,
CONF_MAC,
@ -122,7 +123,7 @@ class AxisFlowHandler(config_entries.ConfigFlow, domain=AXIS_DOMAIN):
same_model = [
entry.data[CONF_NAME]
for entry in self.hass.config_entries.async_entries(AXIS_DOMAIN)
if entry.data[CONF_MODEL] == model
if entry.source != SOURCE_IGNORE and entry.data[CONF_MODEL] == model
]
name = model

View file

@ -8,7 +8,7 @@ from homeassistant.components.axis.const import (
DEFAULT_STREAM_PROFILE,
DOMAIN as AXIS_DOMAIN,
)
from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF
from homeassistant.config_entries import SOURCE_IGNORE, SOURCE_USER, SOURCE_ZEROCONF
from homeassistant.const import (
CONF_HOST,
CONF_MAC,
@ -31,6 +31,8 @@ from tests.common import MockConfigEntry
async def test_flow_manual_configuration(hass):
"""Test that config flow works."""
MockConfigEntry(domain=AXIS_DOMAIN, source=SOURCE_IGNORE).add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
AXIS_DOMAIN, context={"source": SOURCE_USER}
)