From efee7ec416a113be4fa5ffe3a0d5b6920a94f90e Mon Sep 17 00:00:00 2001 From: balgerion <133121849+balgerion@users.noreply.github.com> Date: Sun, 27 Apr 2025 23:03:21 +0200 Subject: [PATCH] Create config_flow.py --- custom_components/config_flow.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 custom_components/config_flow.py diff --git a/custom_components/config_flow.py b/custom_components/config_flow.py new file mode 100644 index 0000000..77f598c --- /dev/null +++ b/custom_components/config_flow.py @@ -0,0 +1,24 @@ +from homeassistant import config_entries +import voluptuous as vol +from .const import DOMAIN + +class PstrykConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): + VERSION = 2 + + async def async_step_user(self, user_input=None): + errors = {} + if user_input is not None: + return self.async_create_entry( + title="Pstryk Energy", + data=user_input + ) + + return self.async_show_form( + step_id="user", + data_schema=vol.Schema({ + vol.Required("api_key"): str, + vol.Required("buy_top", default=5): vol.All(vol.Coerce(int), vol.Range(min=1, max=24)), + vol.Required("sell_top", default=5): vol.All(vol.Coerce(int), vol.Range(min=1, max=24)) + }), + errors=errors + )