From 58c882f026bdf1c70087522904ba8b5c7e9e4db8 Mon Sep 17 00:00:00 2001 From: grm Date: Sun, 17 Jul 2022 00:22:58 +0200 Subject: [PATCH] Bump py-smart-gardena version and trying to correct loooong home assistant startup issue --- custom_components/gardena_smart_system/__init__.py | 9 +++++---- custom_components/gardena_smart_system/manifest.json | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/custom_components/gardena_smart_system/__init__.py b/custom_components/gardena_smart_system/__init__.py index efbfe85..6b861cc 100644 --- a/custom_components/gardena_smart_system/__init__.py +++ b/custom_components/gardena_smart_system/__init__.py @@ -1,4 +1,5 @@ """Support for Gardena Smart System devices.""" +import asyncio import logging from gardena.exceptions.authentication_exception import AuthenticationException @@ -71,10 +72,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: class GardenaSmartSystem: """A Gardena Smart System wrapper class.""" - def __init__(self, hass, *, client_id, client_secret, smart_system=SmartSystem): + def __init__(self, hass, client_id, client_secret): """Initialize the Gardena Smart System.""" self._hass = hass - self.smart_system = smart_system( + self.smart_system = SmartSystem( client_id=client_id, client_secret=client_secret) @@ -94,8 +95,8 @@ async def start(self): await self.smart_system.update_devices(location) self._hass.data[DOMAIN][GARDENA_LOCATION] = location _LOGGER.debug("Starting GardenaSmartSystem websocket") - self._hass.async_create_task(self.smart_system.start_ws(self._hass.data[DOMAIN][GARDENA_LOCATION])) - _LOGGER.debug("Websockete connected !") + asyncio.create_task(self.smart_system.start_ws(self._hass.data[DOMAIN][GARDENA_LOCATION])) + _LOGGER.debug("Websocket thread launched !") except AuthenticationException as ex: _LOGGER.error( f"Authentication failed : {ex.message}. You may need to check your token or create a new app in the gardena api and use the new token.") diff --git a/custom_components/gardena_smart_system/manifest.json b/custom_components/gardena_smart_system/manifest.json index 345b336..4e20b11 100644 --- a/custom_components/gardena_smart_system/manifest.json +++ b/custom_components/gardena_smart_system/manifest.json @@ -7,5 +7,5 @@ "issue_tracker": "https://github.com/py-smart-gardena/hass-gardena-smart-system/issues", "dependencies": [], "codeowners": ["@py-smart-gardena"], - "requirements": ["py-smart-gardena==1.3.1"] + "requirements": ["py-smart-gardena==1.3.2"] }