Fix ignored Axis config entries doesn't break set up of new entries (#44062)
This commit is contained in:
parent
dd0afc3b66
commit
20c3fdfe14
2 changed files with 5 additions and 2 deletions
|
@ -5,6 +5,7 @@ from ipaddress import ip_address
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
|
from homeassistant.config_entries import SOURCE_IGNORE
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_MAC,
|
CONF_MAC,
|
||||||
|
@ -122,7 +123,7 @@ class AxisFlowHandler(config_entries.ConfigFlow, domain=AXIS_DOMAIN):
|
||||||
same_model = [
|
same_model = [
|
||||||
entry.data[CONF_NAME]
|
entry.data[CONF_NAME]
|
||||||
for entry in self.hass.config_entries.async_entries(AXIS_DOMAIN)
|
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
|
name = model
|
||||||
|
|
|
@ -8,7 +8,7 @@ from homeassistant.components.axis.const import (
|
||||||
DEFAULT_STREAM_PROFILE,
|
DEFAULT_STREAM_PROFILE,
|
||||||
DOMAIN as AXIS_DOMAIN,
|
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 (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_MAC,
|
CONF_MAC,
|
||||||
|
@ -31,6 +31,8 @@ from tests.common import MockConfigEntry
|
||||||
|
|
||||||
async def test_flow_manual_configuration(hass):
|
async def test_flow_manual_configuration(hass):
|
||||||
"""Test that config flow works."""
|
"""Test that config flow works."""
|
||||||
|
MockConfigEntry(domain=AXIS_DOMAIN, source=SOURCE_IGNORE).add_to_hass(hass)
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
AXIS_DOMAIN, context={"source": SOURCE_USER}
|
AXIS_DOMAIN, context={"source": SOURCE_USER}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue