From 5d34c21ef2eca541c839d5b2f0b452087a094a09 Mon Sep 17 00:00:00 2001 From: Adrian Rumpold Date: Fri, 18 Jun 2021 17:55:21 +0200 Subject: [PATCH] feat: Enable config flow --- .../config_flow.py | 29 +++++++++++++++++++ .../manifest.json | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 custom_components/home_assistant_covid19_augsburg/config_flow.py diff --git a/custom_components/home_assistant_covid19_augsburg/config_flow.py b/custom_components/home_assistant_covid19_augsburg/config_flow.py new file mode 100644 index 0000000..97c4aa5 --- /dev/null +++ b/custom_components/home_assistant_covid19_augsburg/config_flow.py @@ -0,0 +1,29 @@ +"""Config flow for Coronavirus Hessen integration.""" +import logging + +import voluptuous as vol +from homeassistant import config_entries + +from .const import DOMAIN + +_LOGGER = logging.getLogger(__name__) + + +class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): + """Handle a config flow for Coronavirus Hessen.""" + + VERSION = 1 + CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL + + async def async_step_user(self, user_input=None): + """Handle the initial step.""" + if user_input is not None: + await self.async_set_unique_id("augsburg") + self._abort_if_unique_id_configured() + return self.async_create_entry(title="COVID-19 Augsburg", data=user_input) + + _LOGGER.debug("Showing config form") + return self.async_show_form( + step_id="user", + data_schema=vol.Schema({}), + ) diff --git a/custom_components/home_assistant_covid19_augsburg/manifest.json b/custom_components/home_assistant_covid19_augsburg/manifest.json index e929ce5..f3f9014 100644 --- a/custom_components/home_assistant_covid19_augsburg/manifest.json +++ b/custom_components/home_assistant_covid19_augsburg/manifest.json @@ -2,7 +2,7 @@ "domain": "covid19_augsburg", "name": "COVID-19 Augsburg", "version": "0.1.0", - "config_flow": false, + "config_flow": true, "documentation": "https://github.com/AdrianoKF/home-assistant-covid19-augsburg", "requirements": ["beautifulsoup4==4.8.2", "requests==2.25.1"], "dependencies": [],