hass-core/homeassistant/components/mullvad/config_flow.py
MeIchthys 1a73cb4791
Mullvad VPN (#44189)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-02-24 12:04:38 +01:00

25 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")