mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +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."""
|
||||
|
||||
from typing import Any
|
||||
|
||||
from mullvad_api import MullvadAPI, MullvadAPIError
|
||||
|
||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||
@ -12,10 +14,10 @@ class MullvadConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
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."""
|
||||
self._async_abort_entries_match()
|
||||
|
||||
errors = {}
|
||||
if user_input is not None:
|
||||
try:
|
||||
|
@ -5,5 +5,6 @@
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/mullvad",
|
||||
"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": {
|
||||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||
|
@ -3815,7 +3815,8 @@
|
||||
"name": "Mullvad VPN",
|
||||
"integration_type": "hub",
|
||||
"config_flow": true,
|
||||
"iot_class": "cloud_polling"
|
||||
"iot_class": "cloud_polling",
|
||||
"single_config_entry": true
|
||||
},
|
||||
"mutesync": {
|
||||
"name": "mutesync",
|
||||
|
@ -51,7 +51,7 @@ async def test_form_user_only_once(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
assert result["type"] == FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
|
||||
|
||||
async def test_connection_error(hass: HomeAssistant) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user