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

workaround: add logging and workaround for HA bug #152729

Jason Rumney 4 месяцев назад
Родитель
Сommit
ec90b0aca3
1 измененных файлов с 6 добавлено и 0 удалено
  1. 6 0
      custom_components/tuya_local/entity.py

+ 6 - 0
custom_components/tuya_local/entity.py

@@ -114,6 +114,12 @@ class TuyaLocalEntity:
         await self._device.async_refresh()
 
     async def async_added_to_hass(self):
+        if not self.enabled:
+            _LOGGER.warning(
+                "HA bug #152729: Entity %s is not enabled, but async_added_to_hass was called",
+                self.unique_id,
+            )
+            return
         self._device.register_entity(self)
         if self._config.deprecated:
             _LOGGER.warning(self._config.deprecation_message)