From 50f6790a27f3e8901edb833ed27a2db25daea7f2 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 7 Nov 2017 21:28:11 -0800 Subject: [PATCH] Remove model info from state (#10399) --- homeassistant/components/light/tradfri.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/light/tradfri.py b/homeassistant/components/light/tradfri.py index 63441e6d8af..c3632351e5f 100644 --- a/homeassistant/components/light/tradfri.py +++ b/homeassistant/components/light/tradfri.py @@ -8,6 +8,7 @@ import asyncio import logging from homeassistant.core import callback +from homeassistant.const import ATTR_BATTERY_LEVEL from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_RGB_COLOR, ATTR_TRANSITION, SUPPORT_BRIGHTNESS, SUPPORT_TRANSITION, SUPPORT_COLOR_TEMP, @@ -181,14 +182,12 @@ class TradfriLight(Light): def device_state_attributes(self): """Return the devices' state attributes.""" info = self._light.device_info - attrs = { - 'manufacturer': info.manufacturer, - 'model_number': info.model_number, - 'serial': info.serial, - 'firmware_version': info.firmware_version, - 'power_source': info.power_source_str, - 'battery_level': info.battery_level - } + + attrs = {} + + if info.battery_level is not None: + attrs[ATTR_BATTERY_LEVEL] = info.battery_level + return attrs @asyncio.coroutine