Add custom_components/$REPO_NAME/config_flow.py

This commit is contained in:
2026-07-24 10:58:50 +03:00
parent 0779350ca8
commit cd6785f7cb
@@ -0,0 +1,25 @@
"""Config flow for $REPO_NAME integration."""
from __future__ import annotations
import logging
from typing import Any
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.core import HomeAssistant
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
STEP_USER_DATA_SCHEMA = vol.Schema({
vol.Required("host"): str,
})
class ConfigFlowHandler(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for $REPO_NAME."""
VERSION = 1
async def async_step_user(self, user_input: dict[str, Any] | None = None) -> Any:
"""Handle the initial step."""
errors: dict[str, str] = {}
if user_input is not None:
return self.async_create_entry(title="$REPO_NAME Integration", data=user_input)
return self.async_show_form(step_id="user", data_schema=STEP_USER_DATA_SCHEMA, errors=errors)