From 19dc4ae173db0d2a617bcde12941c0325c95ddc5 Mon Sep 17 00:00:00 2001 From: SukramJ Date: Fri, 4 Feb 2022 13:31:12 +0100 Subject: [PATCH] Start hub earlier (#268) --- changelog.txt | 3 +++ hahomematic/central_unit.py | 17 +++++++++-------- setup.py | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/changelog.txt b/changelog.txt index ad4664d0..164eff40 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +Version 0.30.1 (2022-02-04) +- Start hub earlier + Version 0.30.0 (2022-02-03) - Add paramset to entity - Add CHANNEL_OPERATION_MODE for HmIP(W)-DRBL4 diff --git a/hahomematic/central_unit.py b/hahomematic/central_unit.py index 0c29a139..7234a586 100644 --- a/hahomematic/central_unit.py +++ b/hahomematic/central_unit.py @@ -192,13 +192,13 @@ async def start(self, check_only: bool = False) -> None: return None await self._start_clients() self._start_connection_checker() - await self._init_hub() async def _start_clients(self) -> None: """Start clients .""" if await self._create_clients(): await self._load_caches() await self._create_devices() + await self._init_hub() await self._init_clients() async def stop(self) -> None: @@ -286,13 +286,14 @@ def _create_hub(self) -> HmHub | HmDummyHub: async def _init_hub(self) -> None: """Init the hub.""" - self.hub = self._create_hub() - _LOGGER.info( - "init_hub: Starting hub for %s", - self.instance_name, - ) - if isinstance(self.hub, HmHub): - await self.hub.fetch_data() + if not self.hub: + self.hub = self._create_hub() + _LOGGER.info( + "init_hub: Starting hub for %s", + self.instance_name, + ) + if self.hub and isinstance(self.hub, HmHub): + await self.hub.fetch_data() def _start_connection_checker(self) -> None: """Start the connection checker.""" diff --git a/setup.py b/setup.py index b671457c..eeaf94f3 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ def readme(): }, PACKAGE_NAME = "hahomematic" HERE = os.path.abspath(os.path.dirname(__file__)) -VERSION = "0.30.0" +VERSION = "0.30.1" PACKAGES = find_packages(exclude=["tests", "tests.*", "dist", "build"])