|
|
@@ -46,13 +46,17 @@ class TuyaLocalEntity:
|
|
|
@property
|
|
|
def name(self):
|
|
|
"""Return the name for the UI."""
|
|
|
- # Super has the logic to get default names from device class.
|
|
|
- super_name = getattr(super(), "name")
|
|
|
- # If we don't have a name, and super also doesn't, we explicitly want to use
|
|
|
- # the device name - avoid the HA warning about implicitly using it.
|
|
|
- if super_name is UNDEFINED:
|
|
|
- super_name = None
|
|
|
- return self._config.name or super_name
|
|
|
+ own_name = self._config.name
|
|
|
+ if not own_name and not self.use_device_name:
|
|
|
+ # super has the translation logic
|
|
|
+ own_name = getattr(super(), "name")
|
|
|
+ return own_name
|
|
|
+
|
|
|
+ @property
|
|
|
+ def use_device_name(self):
|
|
|
+ """Return whether to use the device name for the entity name"""
|
|
|
+ own_name = self._config.name or self._attr_translation_key
|
|
|
+ return not own_name
|
|
|
|
|
|
@property
|
|
|
def unique_id(self):
|