From 992c0cd3ee492bea1b7b50d46e0b7611783a2b48 Mon Sep 17 00:00:00 2001 From: damarco Date: Sun, 9 Dec 2018 11:26:29 +0100 Subject: [PATCH 1/2] Always add friendly name attribute --- homeassistant/components/zha/entities/entity.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/homeassistant/components/zha/entities/entity.py b/homeassistant/components/zha/entities/entity.py index da8f615a6650f5..05e34b24b70487 100644 --- a/homeassistant/components/zha/entities/entity.py +++ b/homeassistant/components/zha/entities/entity.py @@ -43,6 +43,11 @@ def __init__(self, endpoint, in_clusters, out_clusters, manufacturer, endpoint.endpoint_id, kwargs.get('entity_suffix', ''), ) + self._device_state_attributes['friendly_name'] = "{}_{}{}".format( + ieeetail, + endpoint.endpoint_id, + kwargs.get('entity_suffix', ''), + ) self._endpoint = endpoint self._in_clusters = in_clusters From 46e0016230066632607f752a5537c07d76fc78b4 Mon Sep 17 00:00:00 2001 From: damarco Date: Thu, 13 Dec 2018 21:06:32 +0100 Subject: [PATCH 2/2] Only change device_info name --- homeassistant/components/zha/entities/entity.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/homeassistant/components/zha/entities/entity.py b/homeassistant/components/zha/entities/entity.py index 05e34b24b70487..25b98255048c9d 100644 --- a/homeassistant/components/zha/entities/entity.py +++ b/homeassistant/components/zha/entities/entity.py @@ -43,11 +43,6 @@ def __init__(self, endpoint, in_clusters, out_clusters, manufacturer, endpoint.endpoint_id, kwargs.get('entity_suffix', ''), ) - self._device_state_attributes['friendly_name'] = "{}_{}{}".format( - ieeetail, - endpoint.endpoint_id, - kwargs.get('entity_suffix', ''), - ) self._endpoint = endpoint self._in_clusters = in_clusters @@ -105,6 +100,6 @@ def device_info(self): 'identifiers': {(DOMAIN, ieee)}, 'manufacturer': self._endpoint.manufacturer, 'model': self._endpoint.model, - 'name': self._device_state_attributes['friendly_name'], + 'name': self._device_state_attributes.get('friendly_name', ieee), 'via_hub': (DOMAIN, self.hass.data[DATA_ZHA][DATA_ZHA_BRIDGE_ID]), }