custom_components/whatsapp_bridge_integration/config_flow.py aktualisiert
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
from .const import DOMAIN, CONF_PHONE_NUMBER, CONF_ACCOUNT_NAME
|
from .const import DOMAIN, CONF_PHONE_NUMBER, CONF_ACCOUNT_NAME
|
||||||
|
|
||||||
class WhatsAppBridgeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
class WhatsAppBridgeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
@@ -8,10 +7,9 @@ class WhatsAppBridgeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
|
||||||
async def async_step_user(self, user_input=None):
|
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 = {}
|
errors = {}
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
# Wir nutzen den Namen als Titel des Eintrags
|
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title=user_input[CONF_ACCOUNT_NAME],
|
title=user_input[CONF_ACCOUNT_NAME],
|
||||||
data=user_input
|
data=user_input
|
||||||
@@ -20,7 +18,7 @@ class WhatsAppBridgeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="user",
|
step_id="user",
|
||||||
data_schema=vol.Schema({
|
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,
|
vol.Required(CONF_PHONE_NUMBER, default="491701234567"): str,
|
||||||
}),
|
}),
|
||||||
errors=errors,
|
errors=errors,
|
||||||
|
|||||||
Reference in New Issue
Block a user