1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-03 20:02:22 +01:00

Device class attribute for sensor component (#1525)

* Add constants for sensor device_class

* Add device_class attribute to sensor component

* Add device_class attribute to sensor class

* Add device_class to mhz19 temperature sensor

* Add device_class to sensor in api component

* Add test for device_class of sensor

* Rename DEVICE_CLASS_NONE to DEVICE_CLASS_EMPTY for consistency

* Make optional attributes of sensor component truly optional
This commit is contained in:
marecabo
2021-02-15 16:49:02 +01:00
committed by GitHub
parent a342302114
commit f95be6a0df
11 changed files with 117 additions and 12 deletions

View File

@@ -663,3 +663,17 @@ UNIT_WATT_HOURS = 'Wh'
DEVICE_CLASS_CONNECTIVITY = 'connectivity'
DEVICE_CLASS_MOVING = 'moving'
DEVICE_CLASS_EMPTY = ''
DEVICE_CLASS_BATTERY = 'battery'
DEVICE_CLASS_CURRENT = 'current'
DEVICE_CLASS_ENERGY = 'energy'
DEVICE_CLASS_HUMIDITY = 'humidity'
DEVICE_CLASS_ILLUMINANCE = 'illuminance'
DEVICE_CLASS_SIGNAL_STRENGTH = 'signal_strength'
DEVICE_CLASS_TEMPERATURE = 'temperature'
DEVICE_CLASS_POWER = 'power'
DEVICE_CLASS_POWER_FACTOR = 'power_factor'
DEVICE_CLASS_PRESSURE = 'pressure'
DEVICE_CLASS_TIMESTAMP = 'timestamp'
DEVICE_CLASS_VOLTAGE = 'voltage'