Fix blocking call in Jewish Calendar while initializing location (#120265)
parent
436c36e3dd
commit
143e8d09af
|
@ -2,6 +2,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from functools import partial
|
||||
|
||||
from hdate import Location
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -129,13 +131,16 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
|||
CONF_HAVDALAH_OFFSET_MINUTES, DEFAULT_HAVDALAH_OFFSET_MINUTES
|
||||
)
|
||||
|
||||
location = Location(
|
||||
name=hass.config.location_name,
|
||||
diaspora=diaspora,
|
||||
latitude=config_entry.data.get(CONF_LATITUDE, hass.config.latitude),
|
||||
longitude=config_entry.data.get(CONF_LONGITUDE, hass.config.longitude),
|
||||
altitude=config_entry.data.get(CONF_ELEVATION, hass.config.elevation),
|
||||
timezone=config_entry.data.get(CONF_TIME_ZONE, hass.config.time_zone),
|
||||
location = await hass.async_add_executor_job(
|
||||
partial(
|
||||
Location,
|
||||
name=hass.config.location_name,
|
||||
diaspora=diaspora,
|
||||
latitude=config_entry.data.get(CONF_LATITUDE, hass.config.latitude),
|
||||
longitude=config_entry.data.get(CONF_LONGITUDE, hass.config.longitude),
|
||||
altitude=config_entry.data.get(CONF_ELEVATION, hass.config.elevation),
|
||||
timezone=config_entry.data.get(CONF_TIME_ZONE, hass.config.time_zone),
|
||||
)
|
||||
)
|
||||
|
||||
hass.data.setdefault(DOMAIN, {})[config_entry.entry_id] = {
|
||||
|
|
Loading…
Reference in New Issue