custom_components/whatsapp_bridge_integration/config_flow.py aktualisiert
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
from homeassistant import config_entries
|
||||
import voluptuous as vol
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from .const import DOMAIN, CONF_PHONE_NUMBER, CONF_ACCOUNT_NAME
|
||||
|
||||
class WhatsAppBridgeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
@@ -8,10 +7,9 @@ class WhatsAppBridgeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
VERSION = 1
|
||||
|
||||
async def async_step_user(self, user_input=None):
|
||||
"""Erster Schritt wenn man auf 'Hinzufügen' klickt."""
|
||||
"""First step when adding the integration via UI."""
|
||||
errors = {}
|
||||
if user_input is not None:
|
||||
# Wir nutzen den Namen als Titel des Eintrags
|
||||
return self.async_create_entry(
|
||||
title=user_input[CONF_ACCOUNT_NAME],
|
||||
data=user_input
|
||||
@@ -20,7 +18,7 @@ class WhatsAppBridgeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
return self.async_show_form(
|
||||
step_id="user",
|
||||
data_schema=vol.Schema({
|
||||
vol.Required(CONF_ACCOUNT_NAME, default="Max Mustermann"): str,
|
||||
vol.Required(CONF_ACCOUNT_NAME, default="John Doe"): str,
|
||||
vol.Required(CONF_PHONE_NUMBER, default="491701234567"): str,
|
||||
}),
|
||||
errors=errors,
|
||||
|
||||
Reference in New Issue
Block a user