mirror of
https://github.com/home-assistant/core.git
synced 2026-05-08 17:49:37 +01:00
Allow multiple config entries for Satel Integra (#155833)
This commit is contained in:
@@ -121,6 +121,8 @@ class SatelConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
errors: dict[str, str] = {}
|
||||
|
||||
if user_input is not None:
|
||||
self._async_abort_entries_match({CONF_HOST: user_input[CONF_HOST]})
|
||||
|
||||
valid = await self.test_connection(
|
||||
user_input[CONF_HOST], user_input[CONF_PORT]
|
||||
)
|
||||
|
||||
@@ -7,6 +7,5 @@
|
||||
"integration_type": "device",
|
||||
"iot_class": "local_push",
|
||||
"loggers": ["satel_integra"],
|
||||
"requirements": ["satel-integra==0.3.7"],
|
||||
"single_config_entry": true
|
||||
"requirements": ["satel-integra==0.3.7"]
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
"code_input_description": "Code to toggle switchable outputs"
|
||||
},
|
||||
"config": {
|
||||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
||||
},
|
||||
|
||||
@@ -5749,8 +5749,7 @@
|
||||
"name": "Satel Integra",
|
||||
"integration_type": "device",
|
||||
"config_flow": true,
|
||||
"iot_class": "local_push",
|
||||
"single_config_entry": true
|
||||
"iot_class": "local_push"
|
||||
},
|
||||
"schlage": {
|
||||
"name": "Schlage",
|
||||
|
||||
@@ -399,7 +399,7 @@ async def test_cannot_create_same_subentry(
|
||||
assert len(mock_setup_entry.mock_calls) == 0
|
||||
|
||||
|
||||
async def test_one_config_allowed(
|
||||
async def test_same_host_config_disallowed(
|
||||
hass: HomeAssistant, mock_config_entry: MockConfigEntry
|
||||
) -> None:
|
||||
"""Test that only one Satel Integra configuration is allowed."""
|
||||
@@ -409,5 +409,14 @@ async def test_one_config_allowed(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {}
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
MOCK_CONFIG_DATA,
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
Reference in New Issue
Block a user