Skip to content

Commit 6591b93

Browse files
committed
Merge branch 'dev'
2 parents dcd2b82 + ad0ef0e commit 6591b93

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

.pre-commit-config.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ repos:
146146
args:
147147
- --reports=no
148148
- --py-version=3.10
149-
# additional_dependencies:
149+
additional_dependencies:
150+
- aiofiles>=0.4.0
150151
# - pylint-blocking-calls
151152
# - homeassistant-stubs>=2023.1.7
152153
# exclude: ^$
@@ -165,6 +166,7 @@ repos:
165166
- --show-error-context
166167
additional_dependencies:
167168
- zigpy==0.61.0
169+
- aiofiles>=0.4.0
168170
# - cryptography==3.3.2 # Compatible/Available on cygwin
169171
#- homeassistant-stubs>=2023.1.7
170172
#- pydantic

custom_components/zha_toolkit/__init__.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -657,12 +657,12 @@ async def async_setup(hass, config):
657657
return True
658658

659659
LOGGER.debug("Setup services from async_setup")
660-
register_services(hass)
660+
await register_services(hass)
661661

662662
return True
663663

664664

665-
def register_services(hass): # noqa: C901
665+
async def register_services(hass): # noqa: C901
666666
global LOADED_VERSION # pylint: disable=global-statement
667667
hass_ref = hass
668668

@@ -710,7 +710,7 @@ async def toolkit_service(service):
710710
LOGGER.debug("module is %s", module)
711711
importlib.reload(u)
712712

713-
if u.getVersion() != LOADED_VERSION:
713+
if await u.getVersion() != LOADED_VERSION:
714714
LOGGER.debug(
715715
"Reload services because VERSION changed from %s to %s",
716716
LOADED_VERSION,
@@ -743,7 +743,7 @@ async def toolkit_service(service):
743743

744744
# Preload event_data
745745
event_data = {
746-
"zha_toolkit_version": u.getVersion(),
746+
"zha_toolkit_version": await u.getVersion(),
747747
"zigpy_version": u.getZigpyVersion(),
748748
"zigpy_rf_version": u.get_radio_version(app),
749749
"ieee_org": ieee_str,
@@ -864,7 +864,7 @@ async def toolkit_service(service):
864864
schema=value,
865865
)
866866

867-
LOADED_VERSION = u.getVersion()
867+
LOADED_VERSION = await u.getVersion()
868868

869869

870870
async def command_handler_default(
@@ -898,7 +898,7 @@ async def command_handler_default(
898898
)
899899

900900

901-
async def reload_services_yaml(hass):
901+
def reload_services_yaml(hass):
902902
import os
903903

904904
from homeassistant.const import CONF_DESCRIPTION, CONF_NAME
@@ -922,7 +922,7 @@ async def reload_services_yaml(hass):
922922

923923
async def _register_services(hass):
924924
register_services(hass)
925-
await reload_services_yaml(hass)
925+
await hass.async_add_executor_job(reload_services_yaml, hass)
926926

927927

928928
#

custom_components/zha_toolkit/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def getZigpyVersion() -> str:
5959
return ZIGPY_VERSION
6060

6161

62-
def getVersion() -> str:
62+
async def getVersion() -> str:
6363
# pylint: disable=global-variable-undefined,used-before-assignment
6464
# pylint: disable=global-statement
6565
global VERSION_TIME

0 commit comments

Comments
 (0)