Explorar o código

Remove overrides of name and translation_key.

Use the underlying Entity class implementations by setting
self._attr_name and self._attr_translation_key instead.

Issue #871, issue from PR #970
Jason Rumney %!s(int64=2) %!d(string=hai) anos
pai
achega
6a69e152cb
Modificáronse 1 ficheiros con 3 adicións e 10 borrados
  1. 3 10
      custom_components/tuya_local/helpers/mixin.py

+ 3 - 10
custom_components/tuya_local/helpers/mixin.py

@@ -20,6 +20,9 @@ class TuyaLocalEntity:
         self._device = device
         self._config = config
         self._attr_dps = []
+        self._attr_name = config.name
+        self._attr_translation_key = config.translation_key
+
         return {c.name: c for c in config.dps()}
 
     def _init_end(self, dps):
@@ -35,16 +38,6 @@ class TuyaLocalEntity:
     def available(self):
         return self._device.has_returned_state
 
-    @property
-    def name(self):
-        """Return the name for the UI."""
-        return self._config.name
-
-    @property
-    def translation_key(self):
-        """Return the translation key."""
-        return self._config.translation_key
-
     @property
     def has_entity_name(self):
         return True