Add tradfri device info (#16768)

This commit is contained in:
Paulus Schoutsen 2018-09-21 14:47:52 +02:00 committed by Pascal Vizeli
parent a0a54dfd5b
commit 3e59ffb33a
4 changed files with 39 additions and 5 deletions

View file

@ -13,7 +13,8 @@ from homeassistant.components.light import (
SUPPORT_COLOR, Light)
from homeassistant.components.light import \
PLATFORM_SCHEMA as LIGHT_PLATFORM_SCHEMA
from homeassistant.components.tradfri import KEY_GATEWAY, KEY_API
from homeassistant.components.tradfri import (
KEY_GATEWAY, KEY_API, DOMAIN as TRADFRI_DOMAIN)
from homeassistant.components.tradfri.const import (
CONF_IMPORT_GROUPS, CONF_GATEWAY_ID)
import homeassistant.util.color as color_util
@ -161,6 +162,7 @@ class TradfriLight(Light):
self._hs_color = None
self._features = SUPPORTED_FEATURES
self._available = True
self._gateway_id = gateway_id
self._refresh(light)
@ -169,6 +171,22 @@ class TradfriLight(Light):
"""Return unique ID for light."""
return self._unique_id
@property
def device_info(self):
"""Return the device info."""
info = self._light.device_info
return {
'identifiers': {
(TRADFRI_DOMAIN, self._light.id)
},
'name': self._name,
'manufacturer': info.manufacturer,
'model': info.model_number,
'sw_version': info.firmware_version,
'via_hub': (TRADFRI_DOMAIN, self._gateway_id),
}
@property
def min_mireds(self):
"""Return the coldest color_temp that this light supports."""