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 + )