1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Allow overriding name via entity registry (#12292)

* Allow overriding name via entity registry

* Update requirements
This commit is contained in:
Paulus Schoutsen
2018-02-11 09:16:01 -08:00
committed by GitHub
parent 8b9eab196c
commit 17e5740a0c
11 changed files with 91 additions and 21 deletions

View File

@@ -80,6 +80,9 @@ class Entity(object):
# Process updates in parallel
parallel_updates = None
# Name in the entity registry
registry_name = None
@property
def should_poll(self) -> bool:
"""Return True if entity has to be polled for state.
@@ -225,7 +228,7 @@ class Entity(object):
if unit_of_measurement is not None:
attr[ATTR_UNIT_OF_MEASUREMENT] = unit_of_measurement
name = self.name
name = self.registry_name or self.name
if name is not None:
attr[ATTR_FRIENDLY_NAME] = name