From 7a56998bb05bafc06e17642969013d70d0c62d67 Mon Sep 17 00:00:00 2001 From: Marc-Olivier Arsenault Date: Mon, 25 Mar 2024 20:10:17 -0400 Subject: [PATCH] add loading timer (#297) --- custom_components/moonraker/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom_components/moonraker/__init__.py b/custom_components/moonraker/__init__.py index 01b098f..c2c9d77 100755 --- a/custom_components/moonraker/__init__.py +++ b/custom_components/moonraker/__init__.py @@ -76,8 +76,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): ) try: - await api.start() + async with async_timeout.timeout(TIMEOUT): + await api.start() printer_info = await api.client.call_method("printer.info") _LOGGER.debug(printer_info) @@ -89,6 +90,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): hass.config_entries.async_update_entry(entry, title=api_device_name) except Exception as exc: + _LOGGER.warning("Cannot configure moonraker instance") raise ConfigEntryNotReady(f"Error connecting to {url}:{port}") from exc coordinator = MoonrakerDataUpdateCoordinator(