Template
Add custom_components/$REPO_NAME/config_flow.py
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user