1 """Config flow for Jewish calendar integration."""
3 from __future__
import annotations
9 import voluptuous
as vol
35 CONF_CANDLE_LIGHT_MINUTES,
37 CONF_HAVDALAH_OFFSET_MINUTES,
40 DEFAULT_HAVDALAH_OFFSET_MINUTES,
51 OPTIONS_SCHEMA = vol.Schema(
53 vol.Optional(CONF_CANDLE_LIGHT_MINUTES, default=DEFAULT_CANDLE_LIGHT): int,
55 CONF_HAVDALAH_OFFSET_MINUTES, default=DEFAULT_HAVDALAH_OFFSET_MINUTES
61 _LOGGER = logging.getLogger(__name__)
66 CONF_LATITUDE: hass.config.latitude,
67 CONF_LONGITUDE: hass.config.longitude,
71 vol.Required(CONF_DIASPORA, default=DEFAULT_DIASPORA):
BooleanSelector(),
72 vol.Required(CONF_LANGUAGE, default=DEFAULT_LANGUAGE):
SelectSelector(
76 vol.Optional(CONF_ELEVATION, default=hass.config.elevation): int,
77 vol.Optional(CONF_TIME_ZONE, default=hass.config.time_zone):
SelectSelector(
79 options=sorted(zoneinfo.available_timezones()),
87 """Handle a config flow for Jewish calendar."""
94 config_entry: ConfigEntry,
95 ) -> JewishCalendarOptionsFlowHandler:
96 """Get the options flow for this handler."""
100 self, user_input: dict[str, Any] |
None =
None
101 ) -> ConfigFlowResult:
102 """Handle the initial step."""
103 if user_input
is not None:
104 if CONF_LOCATION
in user_input:
105 user_input[CONF_LATITUDE] = user_input[CONF_LOCATION][CONF_LATITUDE]
106 user_input[CONF_LONGITUDE] = user_input[CONF_LOCATION][CONF_LONGITUDE]
117 self, user_input: dict[str, Any] |
None =
None
118 ) -> ConfigFlowResult:
119 """Handle a reconfiguration flow initialized by the user."""
125 reconfigure_entry.data,
127 step_id=
"reconfigure",
134 """Handle Jewish Calendar options."""
137 self, user_input: dict[str, str] |
None =
None
138 ) -> ConfigFlowResult:
139 """Manage the Jewish Calendar options."""
140 if user_input
is not None:
JewishCalendarOptionsFlowHandler async_get_options_flow(ConfigEntry config_entry)
ConfigFlowResult async_step_reconfigure(self, dict[str, Any]|None user_input=None)
ConfigFlowResult async_step_user(self, dict[str, Any]|None user_input=None)
ConfigFlowResult async_step_init(self, dict[str, str]|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_update_reload_and_abort(self, ConfigEntry entry, *str|None|UndefinedType unique_id=UNDEFINED, str|UndefinedType title=UNDEFINED, Mapping[str, Any]|UndefinedType data=UNDEFINED, Mapping[str, Any]|UndefinedType data_updates=UNDEFINED, Mapping[str, Any]|UndefinedType options=UNDEFINED, str|UndefinedType reason=UNDEFINED, bool reload_even_if_entry_is_unchanged=True)
ConfigEntry _get_reconfigure_entry(self)
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)
vol.Schema add_suggested_values_to_schema(self, vol.Schema data_schema, Mapping[str, Any]|None suggested_values)
_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)
vol.Schema _get_data_schema(HomeAssistant hass)