瀏覽代碼

HA bug #152729: raise an error so a stack trace is output

This is to help track down where the issue is coming from, and confirm it
is really an HA issue and not something silly we are doing.
Jason Rumney 1 年之前
父節點
當前提交
d4c16bb9a0
共有 1 個文件被更改,包括 2 次插入 和 5 次删除
  1. 2 5
      custom_components/tuya_local/entity.py

+ 2 - 5
custom_components/tuya_local/entity.py

@@ -9,6 +9,7 @@ from homeassistant.const import (
     UnitOfArea,
     UnitOfTemperature,
 )
+from homeassistant.exceptions import HomeAssistantError
 from homeassistant.helpers.entity import EntityCategory
 
 _LOGGER = logging.getLogger(__name__)
@@ -115,11 +116,7 @@ class TuyaLocalEntity:
 
     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
+            raise HomeAssistantError("HA bug #152729")
         self._device.register_entity(self)
         if self._config.deprecated:
             _LOGGER.warning(self._config.deprecation_message)