Browse Source

workaround: add logging and workaround for HA bug #152729

Jason Rumney 4 months ago
parent
commit
ec90b0aca3
1 changed files with 6 additions and 0 deletions
  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()
         await self._device.async_refresh()
 
 
     async def async_added_to_hass(self):
     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)
         self._device.register_entity(self)
         if self._config.deprecated:
         if self._config.deprecated:
             _LOGGER.warning(self._config.deprecation_message)
             _LOGGER.warning(self._config.deprecation_message)