Skip to content

Commit ea9ec58

Browse files
authored
Allow translation key even when device class is overridden (#234)
1 parent d1ce574 commit ea9ec58

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

zha/application/platforms/__init__.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -340,21 +340,19 @@ def _init_from_quirks_metadata(self, entity_metadata: EntityMetadata) -> None:
340340
if entity_metadata.initially_disabled:
341341
self._attr_entity_registry_enabled_default = False
342342

343-
has_device_class = hasattr(entity_metadata, "device_class")
344343
has_attribute_name = hasattr(entity_metadata, "attribute_name")
345344
has_command_name = hasattr(entity_metadata, "command_name")
346345
has_fallback_name = hasattr(entity_metadata, "fallback_name")
347346

348-
if not has_device_class or entity_metadata.device_class is None:
349-
if has_fallback_name:
350-
self._attr_fallback_name = entity_metadata.fallback_name
347+
if has_fallback_name:
348+
self._attr_fallback_name = entity_metadata.fallback_name
351349

352-
if entity_metadata.translation_key:
353-
self._attr_translation_key = entity_metadata.translation_key
354-
elif has_attribute_name:
355-
self._attr_translation_key = entity_metadata.attribute_name
356-
elif has_command_name:
357-
self._attr_translation_key = entity_metadata.command_name
350+
if entity_metadata.translation_key:
351+
self._attr_translation_key = entity_metadata.translation_key
352+
elif has_attribute_name:
353+
self._attr_translation_key = entity_metadata.attribute_name
354+
elif has_command_name:
355+
self._attr_translation_key = entity_metadata.command_name
358356

359357
if has_attribute_name:
360358
self._unique_id_suffix = entity_metadata.attribute_name

0 commit comments

Comments
 (0)