Просмотр исходного кода

Don't import device_config helper until needed.

Although the unit tests are able to run by limiting the import of device in __init__ until needed, the actual use in HA is still blocked.  Try to break this deadlock.
Jason Rumney 4 лет назад
Родитель
Сommit
cbc6e6b0de
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      custom_components/tuya_local/device.py

+ 2 - 1
custom_components/tuya_local/device.py

@@ -16,7 +16,6 @@ from .const import (
     API_PROTOCOL_VERSIONS,
     DOMAIN,
 )
-from .helpers.device_config import possible_matches
 
 _LOGGER = logging.getLogger(__name__)
 
@@ -79,6 +78,8 @@ class TuyaLocalDevice(object):
 
     async def async_inferred_type(self):
 
+        from .helpers.device_config import possible_matches
+
         cached_state = self._get_cached_state()
         if "1" not in cached_state and "3" not in cached_state:
             await self.async_refresh()