mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 06:37:52 +00:00
Blow up if setting translation key on entities without entity name
This commit is contained in:
parent
2f6fcb5801
commit
c85d29db7c
@ -689,6 +689,10 @@ class Entity(
|
||||
"""Return the name of the entity."""
|
||||
if hasattr(self, "_attr_name"):
|
||||
return self._attr_name
|
||||
if self._name_translation_key and not self.has_entity_name:
|
||||
raise ValueError(
|
||||
"Entity has a translation key but has_entity_name is False"
|
||||
)
|
||||
if (
|
||||
self.has_entity_name
|
||||
and (name_translation_key := self._name_translation_key)
|
||||
|
Loading…
x
Reference in New Issue
Block a user