diff --git a/custom_components/whatsapp_bridge_integration/config_flow.py b/custom_components/whatsapp_bridge_integration/config_flow.py new file mode 100644 index 0000000..010c1c0 --- /dev/null +++ b/custom_components/whatsapp_bridge_integration/config_flow.py @@ -0,0 +1,27 @@ +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): + """Handle a config flow for WhatsApp Bridge.""" + VERSION = 1 + + async def async_step_user(self, user_input=None): + """Erster Schritt wenn man auf 'Hinzufügen' klickt.""" + 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 + ) + + return self.async_show_form( + step_id="user", + data_schema=vol.Schema({ + vol.Required(CONF_ACCOUNT_NAME, default="Max Mustermann"): str, + vol.Required(CONF_PHONE_NUMBER, default="491701234567"): str, + }), + errors=errors, + ) \ No newline at end of file