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

Revert "Entity naming: use device name if translation_key is device class"

This reverts commit 065ece9bb3537eba71111ad33f290054cd3bfa80.
Issue #1856

This change interferes with sensor naming.

I'm not sure why the sensor naming based on class translations is
working, but switches are not in #1856
Jason Rumney 1 год назад
Родитель
Сommit
8528f3e49e
1 измененных файлов с 1 добавлено и 4 удалено
  1. 1 4
      custom_components/tuya_local/helpers/mixin.py

+ 1 - 4
custom_components/tuya_local/helpers/mixin.py

@@ -55,10 +55,7 @@ class TuyaLocalEntity:
     @property
     def use_device_name(self):
         """Return whether to use the device name for the entity name"""
-        alt_name = self._config.translation_key
-        if self._config.translation_key is self._config.device_class:
-            alt_name = None
-        own_name = self._config.name or alt_name
+        own_name = self._config.name or self._config.translation_key
         return not own_name
 
     @property