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
2018-05-05 15:37:40 +02:00
committed by Paulus Schoutsen
parent ec3ce4c80d
commit 95d27bd1fa
19 changed files with 92 additions and 79 deletions

View File

@@ -4,7 +4,9 @@ Demo platform that has a couple of fake sensors.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/
"""
from homeassistant.const import ATTR_BATTERY_LEVEL, TEMP_CELSIUS
from homeassistant.const import (
ATTR_BATTERY_LEVEL, TEMP_CELSIUS, DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_TEMPERATURE)
from homeassistant.helpers.entity import Entity
@@ -12,9 +14,9 @@ from homeassistant.helpers.entity import Entity
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the Demo sensors."""
add_devices([
DemoSensor('Outside Temperature', 15.6, 'temperature',
DemoSensor('Outside Temperature', 15.6, DEVICE_CLASS_TEMPERATURE,
TEMP_CELSIUS, 12),
DemoSensor('Outside Humidity', 54, 'humidity', '%', None),
DemoSensor('Outside Humidity', 54, DEVICE_CLASS_HUMIDITY, '%', None),
])