mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 05:06:33 +01:00
Fix: Detected blocking call to import_module inside the event loop
This commit is contained in:
@@ -79,7 +79,10 @@ class WasteCollectionConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
# Step 3: User fills in source arguments
|
||||
async def async_step_args(self, args_input=None):
|
||||
# Import source and get arguments
|
||||
module = importlib.import_module(f"waste_collection_schedule.source.{self._source}")
|
||||
module = await self.hass.async_add_executor_job(
|
||||
importlib.import_module,
|
||||
f"waste_collection_schedule.source.{self._source}"
|
||||
)
|
||||
title = module.TITLE
|
||||
|
||||
args = dict(inspect.signature(module.Source.__init__).parameters)
|
||||
|
||||
@@ -37,11 +37,11 @@ async def async_setup_entry(hass: HomeAssistant, entry) -> bool:
|
||||
entry contains data from config entry database."""
|
||||
options = entry.options
|
||||
|
||||
shell = SourceShell.create(
|
||||
source_name=entry.data[CONF_SOURCE_NAME],
|
||||
source_args=entry.data[CONF_SOURCE_ARGS],
|
||||
customize={}, # TODO
|
||||
calendar_title=options.get(CONF_SOURCE_CALENDAR_TITLE)
|
||||
shell = await hass.async_add_executor_job(SourceShell.create,
|
||||
entry.data[CONF_SOURCE_NAME],
|
||||
{},
|
||||
entry.data[CONF_SOURCE_ARGS],
|
||||
options.get(CONF_SOURCE_CALENDAR_TITLE)
|
||||
)
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user