1 """Config flow to configure the Stookwijzer integration."""
3 from __future__
import annotations
7 from stookwijzer
import Stookwijzer
8 import voluptuous
as vol
15 from .const
import DOMAIN
19 """Config flow for Stookwijzer."""
24 self, user_input: dict[str, Any] |
None =
None
25 ) -> ConfigFlowResult:
26 """Handle a flow initialized by the user."""
28 if user_input
is not None:
29 latitude, longitude = await Stookwijzer.async_transform_coordinates(
31 user_input[CONF_LOCATION][CONF_LATITUDE],
32 user_input[CONF_LOCATION][CONF_LONGITUDE],
34 if latitude
and longitude:
37 data={CONF_LATITUDE: latitude, CONF_LONGITUDE: longitude},
39 errors[
"base"] =
"unknown"
44 data_schema=vol.Schema(
49 CONF_LATITUDE: self.hass.config.latitude,
50 CONF_LONGITUDE: self.hass.config.longitude,
ConfigFlowResult async_step_user(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)
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)
_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)
aiohttp.ClientSession async_get_clientsession(HomeAssistant hass, bool verify_ssl=True, socket.AddressFamily family=socket.AF_UNSPEC, ssl_util.SSLCipherList ssl_cipher=ssl_util.SSLCipherList.PYTHON_DEFAULT)