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

fix (entities): ensure logger is available before use

Jason Rumney 3 дней назад
Родитель
Сommit
b79780a6c3

+ 2 - 0
custom_components/tuya_local/lawn_mower.py

@@ -16,6 +16,8 @@ from .entity import TuyaLocalEntity
 from .helpers.config import async_tuya_setup_platform
 from .helpers.device_config import TuyaEntityConfig
 
+_LOGGER = logging.getLogger(__name__)
+
 
 async def async_setup_entry(hass, config_entry, async_add_entities):
     config = {**config_entry.data, **config_entry.options}

+ 2 - 0
custom_components/tuya_local/lock.py

@@ -11,6 +11,8 @@ from .entity import TuyaLocalEntity
 from .helpers.config import async_tuya_setup_platform
 from .helpers.device_config import TuyaEntityConfig
 
+_LOGGER = logging.getLogger(__name__)
+
 # Remote Code unlocking protocol: 8 digit code set when paired by
 # remote_no_pd_setkey (typically dp 60), user can obtain by
 # eavesdropping cloud unlock messages.

+ 2 - 0
custom_components/tuya_local/select.py

@@ -9,6 +9,8 @@ from .entity import TuyaLocalEntity
 from .helpers.config import async_tuya_setup_platform
 from .helpers.device_config import TuyaEntityConfig
 
+_LOGGER = logging.getLogger(__name__)
+
 
 async def async_setup_entry(hass, config_entry, async_add_entities):
     config = {**config_entry.data, **config_entry.options}

+ 2 - 0
custom_components/tuya_local/siren.py

@@ -14,6 +14,8 @@ from .entity import TuyaLocalEntity
 from .helpers.config import async_tuya_setup_platform
 from .helpers.device_config import TuyaEntityConfig
 
+_LOGGER = logging.getLogger(__name__)
+
 
 async def async_setup_entry(hass, config_entry, async_add_entities):
     config = {**config_entry.data, **config_entry.options}

+ 2 - 0
custom_components/tuya_local/vacuum.py

@@ -16,6 +16,8 @@ from .entity import TuyaLocalEntity
 from .helpers.config import async_tuya_setup_platform
 from .helpers.device_config import TuyaEntityConfig
 
+_LOGGER = logging.getLogger(__name__)
+
 
 async def async_setup_entry(hass, config_entry, async_add_entities):
     config = {**config_entry.data, **config_entry.options}