@@ -657,12 +657,12 @@ async def async_setup(hass, config):
657
657
return True
658
658
659
659
LOGGER .debug ("Setup services from async_setup" )
660
- register_services (hass )
660
+ await register_services (hass )
661
661
662
662
return True
663
663
664
664
665
- def register_services (hass ): # noqa: C901
665
+ async def register_services (hass ): # noqa: C901
666
666
global LOADED_VERSION # pylint: disable=global-statement
667
667
hass_ref = hass
668
668
@@ -710,7 +710,7 @@ async def toolkit_service(service):
710
710
LOGGER .debug ("module is %s" , module )
711
711
importlib .reload (u )
712
712
713
- if u .getVersion () != LOADED_VERSION :
713
+ if await u .getVersion () != LOADED_VERSION :
714
714
LOGGER .debug (
715
715
"Reload services because VERSION changed from %s to %s" ,
716
716
LOADED_VERSION ,
@@ -743,7 +743,7 @@ async def toolkit_service(service):
743
743
744
744
# Preload event_data
745
745
event_data = {
746
- "zha_toolkit_version" : u .getVersion (),
746
+ "zha_toolkit_version" : await u .getVersion (),
747
747
"zigpy_version" : u .getZigpyVersion (),
748
748
"zigpy_rf_version" : u .get_radio_version (app ),
749
749
"ieee_org" : ieee_str ,
@@ -864,7 +864,7 @@ async def toolkit_service(service):
864
864
schema = value ,
865
865
)
866
866
867
- LOADED_VERSION = u .getVersion ()
867
+ LOADED_VERSION = await u .getVersion ()
868
868
869
869
870
870
async def command_handler_default (
@@ -898,7 +898,7 @@ async def command_handler_default(
898
898
)
899
899
900
900
901
- async def reload_services_yaml (hass ):
901
+ def reload_services_yaml (hass ):
902
902
import os
903
903
904
904
from homeassistant .const import CONF_DESCRIPTION , CONF_NAME
@@ -922,7 +922,7 @@ async def reload_services_yaml(hass):
922
922
923
923
async def _register_services (hass ):
924
924
register_services (hass )
925
- await reload_services_yaml ( hass )
925
+ await hass . async_add_executor_job ( reload_services_yaml , hass )
926
926
927
927
928
928
#
0 commit comments