diff --git a/custom_components/zha_toolkit/__init__.py b/custom_components/zha_toolkit/__init__.py index a026095..1ac69c0 100644 --- a/custom_components/zha_toolkit/__init__.py +++ b/custom_components/zha_toolkit/__init__.py @@ -652,12 +652,12 @@ async def async_setup(hass, config): return True LOGGER.debug("Setup services from async_setup") - register_services(hass) + await register_services(hass) return True -def register_services(hass): # noqa: C901 +async def register_services(hass): # noqa: C901 global LOADED_VERSION # pylint: disable=global-statement hass_ref = hass @@ -705,7 +705,7 @@ async def toolkit_service(service): LOGGER.debug("module is %s", module) importlib.reload(u) - currentVersion = hass.async_add_executor_job(u.getVersion) + currentVersion = await u.getVersion() if currentVersion != LOADED_VERSION: LOGGER.debug( "Reload services because VERSION changed from %s to %s", @@ -860,7 +860,7 @@ async def toolkit_service(service): schema=value, ) - LOADED_VERSION = u.getVersion() + LOADED_VERSION = await u.getVersion() async def command_handler_default( diff --git a/custom_components/zha_toolkit/utils.py b/custom_components/zha_toolkit/utils.py index 7607d67..0282296 100644 --- a/custom_components/zha_toolkit/utils.py +++ b/custom_components/zha_toolkit/utils.py @@ -55,7 +55,7 @@ def getZigpyVersion() -> str: return ZIGPY_VERSION -def getVersion() -> str: +async def getVersion() -> str: # pylint: disable=global-variable-undefined,used-before-assignment # pylint: disable=global-statement global VERSION_TIME