1 """Config flow for Speedtest.net."""
3 from __future__
import annotations
7 import voluptuous
as vol
12 from .
import SpeedTestConfigEntry
23 """Handle Speedtest.net config flow."""
30 config_entry: SpeedTestConfigEntry,
31 ) -> SpeedTestOptionsFlowHandler:
32 """Get the options flow for this handler."""
36 self, user_input: dict[str, Any] |
None =
None
37 ) -> ConfigFlowResult:
38 """Handle a flow initialized by the user."""
42 if user_input
is None:
49 """Handle SpeedTest options."""
52 """Initialize options flow."""
56 self, user_input: dict[str, Any] |
None =
None
57 ) -> ConfigFlowResult:
58 """Manage the options."""
59 errors: dict[str, str] = {}
61 if user_input
is not None:
62 server_name = user_input[CONF_SERVER_NAME]
63 if server_name !=
"*Auto Detect":
64 server_id = self.
_servers_servers[server_name][
"id"]
65 user_input[CONF_SERVER_ID] = server_id
67 user_input[CONF_SERVER_ID] =
None
77 ): vol.In(self.
_servers_servers.keys()),
81 step_id=
"init", data_schema=vol.Schema(options), errors=errors
SpeedTestOptionsFlowHandler async_get_options_flow(SpeedTestConfigEntry config_entry)
ConfigFlowResult async_step_user(self, dict[str, Any]|None user_input=None)
ConfigFlowResult async_step_init(self, dict[str, Any]|None user_input=None)
ConfigFlowResult async_create_entry(self, *str title, Mapping[str, Any] data, str|None description=None, Mapping[str, str]|None description_placeholders=None, Mapping[str, Any]|None options=None)
list[ConfigEntry] _async_current_entries(self, bool|None include_ignore=None)
ConfigFlowResult async_abort(self, *str reason, Mapping[str, str]|None description_placeholders=None)
ConfigFlowResult async_show_form(self, *str|None step_id=None, vol.Schema|None data_schema=None, dict[str, str]|None errors=None, Mapping[str, str]|None description_placeholders=None, bool|None last_step=None, str|None preview=None)
ConfigEntry config_entry(self)
None config_entry(self, ConfigEntry value)
_FlowResultT async_show_form(self, *str|None step_id=None, vol.Schema|None data_schema=None, dict[str, str]|None errors=None, Mapping[str, str]|None description_placeholders=None, bool|None last_step=None, str|None preview=None)
_FlowResultT async_create_entry(self, *str|None title=None, Mapping[str, Any] data, str|None description=None, Mapping[str, str]|None description_placeholders=None)
_FlowResultT async_abort(self, *str reason, Mapping[str, str]|None description_placeholders=None)