25 lines
895 B
Python
25 lines
895 B
Python
from homeassistant import config_entries
|
|
import voluptuous as vol
|
|
from .const import DOMAIN, CONF_PHONE_NUMBER, CONF_ACCOUNT_NAME
|
|
|
|
class WhatsAppBridgeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|
"""Handle a config flow for WhatsApp Bridge."""
|
|
VERSION = 1
|
|
|
|
async def async_step_user(self, user_input=None):
|
|
"""First step when adding the integration via UI."""
|
|
errors = {}
|
|
if user_input is not None:
|
|
return self.async_create_entry(
|
|
title=user_input[CONF_ACCOUNT_NAME],
|
|
data=user_input
|
|
)
|
|
|
|
return self.async_show_form(
|
|
step_id="user",
|
|
data_schema=vol.Schema({
|
|
vol.Required(CONF_ACCOUNT_NAME, default="John Doe"): str,
|
|
vol.Required(CONF_PHONE_NUMBER, default="491701234567"): str,
|
|
}),
|
|
errors=errors,
|
|
) |