mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add single config entry to Mullvad (#114426)
* Add single config entry to Mullvad * Add single config entry to Mullvad * Add single config entry to Mullvad * Fix
This commit is contained in:
parent
247ee6e4f0
commit
ed7e5c4de6
@ -1,5 +1,7 @@
|
|||||||
"""Config flow for Mullvad VPN integration."""
|
"""Config flow for Mullvad VPN integration."""
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from mullvad_api import MullvadAPI, MullvadAPIError
|
from mullvad_api import MullvadAPI, MullvadAPIError
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||||
@ -12,10 +14,10 @@ class MullvadConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
|
||||||
async def async_step_user(self, user_input=None) -> ConfigFlowResult:
|
async def async_step_user(
|
||||||
|
self, user_input: dict[str, Any] | None = None
|
||||||
|
) -> ConfigFlowResult:
|
||||||
"""Handle the initial step."""
|
"""Handle the initial step."""
|
||||||
self._async_abort_entries_match()
|
|
||||||
|
|
||||||
errors = {}
|
errors = {}
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
try:
|
try:
|
||||||
|
@ -5,5 +5,6 @@
|
|||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/mullvad",
|
"documentation": "https://www.home-assistant.io/integrations/mullvad",
|
||||||
"iot_class": "cloud_polling",
|
"iot_class": "cloud_polling",
|
||||||
"requirements": ["mullvad-api==1.0.0"]
|
"requirements": ["mullvad-api==1.0.0"],
|
||||||
|
"single_config_entry": true
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
{
|
{
|
||||||
"config": {
|
"config": {
|
||||||
"abort": {
|
|
||||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
|
|
||||||
},
|
|
||||||
"error": {
|
"error": {
|
||||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||||
|
@ -3815,7 +3815,8 @@
|
|||||||
"name": "Mullvad VPN",
|
"name": "Mullvad VPN",
|
||||||
"integration_type": "hub",
|
"integration_type": "hub",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"iot_class": "cloud_polling"
|
"iot_class": "cloud_polling",
|
||||||
|
"single_config_entry": true
|
||||||
},
|
},
|
||||||
"mutesync": {
|
"mutesync": {
|
||||||
"name": "mutesync",
|
"name": "mutesync",
|
||||||
|
@ -51,7 +51,7 @@ async def test_form_user_only_once(hass: HomeAssistant) -> None:
|
|||||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||||
)
|
)
|
||||||
assert result["type"] == FlowResultType.ABORT
|
assert result["type"] == FlowResultType.ABORT
|
||||||
assert result["reason"] == "already_configured"
|
assert result["reason"] == "single_instance_allowed"
|
||||||
|
|
||||||
|
|
||||||
async def test_connection_error(hass: HomeAssistant) -> None:
|
async def test_connection_error(hass: HomeAssistant) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user