LifeFlow/home-assistant/custom_components/lifeflow/config_flow.py

42 lines
1.1 KiB
Python

"""LifeFlow Home Assistant Integration."""
from __future__ import annotations
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.const import CONF_NAME
from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.selector import (
SelectSelector,
SelectSelectorConfig,
)
from .const import DOMAIN
class LifeFlowConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for LifeFlow."""
VERSION = 1
async def async_step_user(
self, user_input: dict[str, str] | None = None
) -> FlowResult:
"""Handle the initial step."""
if user_input is None:
return self.async_show_form(
step_id="user",
data_schema=vol.Schema({
vol.Required(CONF_NAME, default="LifeFlow"): str,
}),
)
await self.async_set_unique_id(DOMAIN)
self._abort_if_unique_id_configured()
return self.async_create_entry(
title=user_input[CONF_NAME],
data=user_input,
)