26 lines
777 B
Python
26 lines
777 B
Python
|
"""Config flow for Mullvad VPN integration."""
|
||
|
import logging
|
||
|
|
||
|
from homeassistant import config_entries
|
||
|
|
||
|
from .const import DOMAIN # pylint:disable=unused-import
|
||
|
|
||
|
_LOGGER = logging.getLogger(__name__)
|
||
|
|
||
|
|
||
|
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||
|
"""Handle a config flow for Mullvad VPN."""
|
||
|
|
||
|
VERSION = 1
|
||
|
CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL
|
||
|
|
||
|
async def async_step_user(self, user_input=None):
|
||
|
"""Handle the initial step."""
|
||
|
if self.hass.config_entries.async_entries(DOMAIN):
|
||
|
return self.async_abort(reason="already_configured")
|
||
|
|
||
|
if user_input is not None:
|
||
|
return self.async_create_entry(title="Mullvad VPN", data=user_input)
|
||
|
|
||
|
return self.async_show_form(step_id="user")
|