mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 19:57:07 +00:00
Don't do I/O while getting Jewish calendar data schema (#142919)
This commit is contained in:
parent
908a7c6991
commit
1480b77461
@ -61,11 +61,14 @@ OPTIONS_SCHEMA = vol.Schema(
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def _get_data_schema(hass: HomeAssistant) -> vol.Schema:
|
async def _get_data_schema(hass: HomeAssistant) -> vol.Schema:
|
||||||
default_location = {
|
default_location = {
|
||||||
CONF_LATITUDE: hass.config.latitude,
|
CONF_LATITUDE: hass.config.latitude,
|
||||||
CONF_LONGITUDE: hass.config.longitude,
|
CONF_LONGITUDE: hass.config.longitude,
|
||||||
}
|
}
|
||||||
|
get_timezones: list[str] = list(
|
||||||
|
await hass.async_add_executor_job(zoneinfo.available_timezones)
|
||||||
|
)
|
||||||
return vol.Schema(
|
return vol.Schema(
|
||||||
{
|
{
|
||||||
vol.Required(CONF_DIASPORA, default=DEFAULT_DIASPORA): BooleanSelector(),
|
vol.Required(CONF_DIASPORA, default=DEFAULT_DIASPORA): BooleanSelector(),
|
||||||
@ -75,9 +78,7 @@ def _get_data_schema(hass: HomeAssistant) -> vol.Schema:
|
|||||||
vol.Optional(CONF_LOCATION, default=default_location): LocationSelector(),
|
vol.Optional(CONF_LOCATION, default=default_location): LocationSelector(),
|
||||||
vol.Optional(CONF_ELEVATION, default=hass.config.elevation): int,
|
vol.Optional(CONF_ELEVATION, default=hass.config.elevation): int,
|
||||||
vol.Optional(CONF_TIME_ZONE, default=hass.config.time_zone): SelectSelector(
|
vol.Optional(CONF_TIME_ZONE, default=hass.config.time_zone): SelectSelector(
|
||||||
SelectSelectorConfig(
|
SelectSelectorConfig(options=get_timezones, sort=True)
|
||||||
options=sorted(zoneinfo.available_timezones()),
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -109,7 +110,7 @@ class JewishCalendarConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="user",
|
step_id="user",
|
||||||
data_schema=self.add_suggested_values_to_schema(
|
data_schema=self.add_suggested_values_to_schema(
|
||||||
_get_data_schema(self.hass), user_input
|
await _get_data_schema(self.hass), user_input
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -121,7 +122,7 @@ class JewishCalendarConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
if not user_input:
|
if not user_input:
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
data_schema=self.add_suggested_values_to_schema(
|
data_schema=self.add_suggested_values_to_schema(
|
||||||
_get_data_schema(self.hass),
|
await _get_data_schema(self.hass),
|
||||||
reconfigure_entry.data,
|
reconfigure_entry.data,
|
||||||
),
|
),
|
||||||
step_id="reconfigure",
|
step_id="reconfigure",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user