mirror of
https://github.com/home-assistant/core.git
synced 2025-11-12 20:40:18 +00:00
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:
@@ -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),
|
||||
])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user