Sensor device classes (#14282)

* Added light device class, moved device classes to const

* Removed unnecessary icons

* Replace 'lux' with 'lx'

* Fix comment

* Changed device_class name
This commit is contained in:
cdce8p authored and Paulus Schoutsen committed 2018-05-05 09:37:40 -04:00
1 parent ec3ce4c80d
commit 95d27bd1fa
19 files changed
+92 -79

No files matched your search

+3 -9
View File
@@ -6,10 +6,10 @@ https://home-assistant.io/components/sensor.deconz/
"""
from homeassistant.components.deconz import (
DOMAIN as DATA_DECONZ, DATA_DECONZ_ID)
from homeassistant.const import ATTR_BATTERY_LEVEL, ATTR_VOLTAGE
from homeassistant.const import (
ATTR_BATTERY_LEVEL, ATTR_VOLTAGE, DEVICE_CLASS_BATTERY)
from homeassistant.core import callback
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.icon import icon_for_battery_level
from homeassistant.util import slugify
DEPENDENCIES = ['deconz']
@@ -126,7 +126,6 @@ class DeconzBattery(Entity):
"""Register dispatcher callback for update of battery state."""
self._device = device
self._name = '{} {}'.format(self._device.name, 'Battery Level')
self._device_class = 'battery'
self._unit_of_measurement = "%"
async def async_added_to_hass(self):
@@ -158,12 +157,7 @@ class DeconzBattery(Entity):
@property
def device_class(self):
"""Return the class of the sensor."""
return self._device_class
@property
def icon(self):
"""Return the icon to use in the frontend."""
return icon_for_battery_level(int(self.state))
return DEVICE_CLASS_BATTERY
@property
def unit_of_measurement(self):