Initial upload. Yes AI was used to help make this. If you want to hate me, call me a vibe coder and yell hateful comments at me, you can do so as I am coming out of my house. I live at 1600 Pennsylvania Ave in lovely.....
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""Config flow for Dispatcharr Sensor integration."""
|
|
from __future__ import annotations
|
|
import logging
|
|
from typing import Any
|
|
import voluptuous as vol
|
|
from homeassistant import config_entries
|
|
from homeassistant.data_entry_flow import FlowResult
|
|
from .const import DOMAIN
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
# Ask for username and password instead of API token
|
|
STEP_USER_DATA_SCHEMA = vol.Schema(
|
|
{
|
|
vol.Required("host"): str,
|
|
vol.Required("port", default=9191): int,
|
|
vol.Required("username"): str,
|
|
vol.Required("password"): str,
|
|
}
|
|
)
|
|
|
|
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|
"""Handle a config flow for Dispatcharr Sensor."""
|
|
|
|
VERSION = 1
|
|
|
|
async def async_step_user(
|
|
self, user_input: dict[str, Any] | None = None
|
|
) -> FlowResult:
|
|
"""Handle the initial step."""
|
|
if user_input is None:
|
|
return self.async_show_form(
|
|
step_id="user", data_schema=STEP_USER_DATA_SCHEMA
|
|
)
|
|
|
|
return self.async_create_entry(title="Dispatcharr", data=user_input) |