Auto set friendly name in state attributes

This commit is contained in:
Paulus Schoutsen 2015-02-28 20:10:39 -08:00
parent 80ffe74af6
commit b38146bdef
5 changed files with 17 additions and 30 deletions

View file

@ -7,7 +7,7 @@ from urllib.parse import urlparse
from homeassistant.loader import get_component
import homeassistant.util as util
from homeassistant.helpers import ToggleDevice
from homeassistant.const import ATTR_FRIENDLY_NAME, CONF_HOST
from homeassistant.const import CONF_HOST
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_XY_COLOR, ATTR_TRANSITION,
ATTR_FLASH, FLASH_LONG, FLASH_SHORT)
@ -153,9 +153,7 @@ class HueLight(ToggleDevice):
@property
def state_attributes(self):
""" Returns optional state attributes. """
attr = {
ATTR_FRIENDLY_NAME: self.name
}
attr = {}
if self.is_on:
attr[ATTR_BRIGHTNESS] = self.info['state']['bri']