From 194b268ae3938b1e80cbac5b984815a5e93f823d Mon Sep 17 00:00:00 2001 From: Keaton Taylor Date: Wed, 7 Dec 2016 23:45:18 -0600 Subject: [PATCH] Get entity name from entity.name (#4798) Grabbing the ATTR_FRIENDLY_NAME directly produces an error. Instead grab from entity.name. --- homeassistant/components/emulated_hue/hue_api.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/emulated_hue/hue_api.py b/homeassistant/components/emulated_hue/hue_api.py index ed06da9495b..32fb4af071c 100644 --- a/homeassistant/components/emulated_hue/hue_api.py +++ b/homeassistant/components/emulated_hue/hue_api.py @@ -6,8 +6,8 @@ from aiohttp import web from homeassistant import core from homeassistant.const import ( - ATTR_ENTITY_ID, ATTR_FRIENDLY_NAME, SERVICE_TURN_OFF, SERVICE_TURN_ON, - STATE_ON, STATE_OFF, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, + ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON, STATE_ON, + STATE_OFF, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, ) from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_SUPPORTED_FEATURES, SUPPORT_BRIGHTNESS @@ -251,8 +251,7 @@ def entity_to_json(entity, is_on=None, brightness=None): if brightness is None: brightness = 255 if is_on else 0 - name = entity.attributes.get( - ATTR_EMULATED_HUE_NAME, entity.attributes[ATTR_FRIENDLY_NAME]) + name = entity.attributes.get(ATTR_EMULATED_HUE_NAME, entity.name) return { 'state':