mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 08:28:12 +01:00
Add new sensor device classes (#3895)
This commit is contained in:
parent
fd57b21aff
commit
786c8b6cfe
2 changed files with 16 additions and 2 deletions
|
@ -29,6 +29,7 @@ from esphome.const import (
|
|||
CONF_WINDOW_SIZE,
|
||||
CONF_MQTT_ID,
|
||||
CONF_FORCE_UPDATE,
|
||||
DEVICE_CLASS_DISTANCE,
|
||||
DEVICE_CLASS_DURATION,
|
||||
DEVICE_CLASS_EMPTY,
|
||||
DEVICE_CLASS_APPARENT_POWER,
|
||||
|
@ -43,6 +44,7 @@ from esphome.const import (
|
|||
DEVICE_CLASS_GAS,
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
DEVICE_CLASS_ILLUMINANCE,
|
||||
DEVICE_CLASS_MOISTURE,
|
||||
DEVICE_CLASS_MONETARY,
|
||||
DEVICE_CLASS_NITROGEN_DIOXIDE,
|
||||
DEVICE_CLASS_NITROGEN_MONOXIDE,
|
||||
|
@ -56,11 +58,14 @@ from esphome.const import (
|
|||
DEVICE_CLASS_PRESSURE,
|
||||
DEVICE_CLASS_REACTIVE_POWER,
|
||||
DEVICE_CLASS_SIGNAL_STRENGTH,
|
||||
DEVICE_CLASS_SPEED,
|
||||
DEVICE_CLASS_SULPHUR_DIOXIDE,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
DEVICE_CLASS_TIMESTAMP,
|
||||
DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS,
|
||||
DEVICE_CLASS_VOLTAGE,
|
||||
DEVICE_CLASS_VOLUME,
|
||||
DEVICE_CLASS_WEIGHT,
|
||||
)
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
from esphome.cpp_generator import MockObjClass
|
||||
|
@ -77,12 +82,14 @@ DEVICE_CLASSES = [
|
|||
DEVICE_CLASS_CARBON_MONOXIDE,
|
||||
DEVICE_CLASS_CURRENT,
|
||||
DEVICE_CLASS_DATE,
|
||||
DEVICE_CLASS_DISTANCE,
|
||||
DEVICE_CLASS_DURATION,
|
||||
DEVICE_CLASS_ENERGY,
|
||||
DEVICE_CLASS_FREQUENCY,
|
||||
DEVICE_CLASS_GAS,
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
DEVICE_CLASS_ILLUMINANCE,
|
||||
DEVICE_CLASS_MOISTURE,
|
||||
DEVICE_CLASS_MONETARY,
|
||||
DEVICE_CLASS_NITROGEN_DIOXIDE,
|
||||
DEVICE_CLASS_NITROGEN_MONOXIDE,
|
||||
|
@ -96,11 +103,14 @@ DEVICE_CLASSES = [
|
|||
DEVICE_CLASS_PRESSURE,
|
||||
DEVICE_CLASS_REACTIVE_POWER,
|
||||
DEVICE_CLASS_SIGNAL_STRENGTH,
|
||||
DEVICE_CLASS_SPEED,
|
||||
DEVICE_CLASS_SULPHUR_DIOXIDE,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
DEVICE_CLASS_TIMESTAMP,
|
||||
DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS,
|
||||
DEVICE_CLASS_VOLTAGE,
|
||||
DEVICE_CLASS_VOLUME,
|
||||
DEVICE_CLASS_WEIGHT,
|
||||
]
|
||||
|
||||
sensor_ns = cg.esphome_ns.namespace("sensor")
|
||||
|
|
|
@ -905,7 +905,6 @@ DEVICE_CLASS_GARAGE_DOOR = "garage_door"
|
|||
DEVICE_CLASS_HEAT = "heat"
|
||||
DEVICE_CLASS_LIGHT = "light"
|
||||
DEVICE_CLASS_LOCK = "lock"
|
||||
DEVICE_CLASS_MOISTURE = "moisture"
|
||||
DEVICE_CLASS_MOTION = "motion"
|
||||
DEVICE_CLASS_MOVING = "moving"
|
||||
DEVICE_CLASS_OCCUPANCY = "occupancy"
|
||||
|
@ -923,15 +922,17 @@ DEVICE_CLASS_WINDOW = "window"
|
|||
# device classes of both binary_sensor and sensor component
|
||||
DEVICE_CLASS_EMPTY = ""
|
||||
DEVICE_CLASS_BATTERY = "battery"
|
||||
DEVICE_CLASS_CARBON_MONOXIDE = "carbon_monoxide"
|
||||
DEVICE_CLASS_GAS = "gas"
|
||||
DEVICE_CLASS_MOISTURE = "moisture"
|
||||
DEVICE_CLASS_POWER = "power"
|
||||
# device classes of sensor component
|
||||
DEVICE_CLASS_APPARENT_POWER = "apparent_power"
|
||||
DEVICE_CLASS_AQI = "aqi"
|
||||
DEVICE_CLASS_CARBON_DIOXIDE = "carbon_dioxide"
|
||||
DEVICE_CLASS_CARBON_MONOXIDE = "carbon_monoxide"
|
||||
DEVICE_CLASS_CURRENT = "current"
|
||||
DEVICE_CLASS_DATE = "date"
|
||||
DEVICE_CLASS_DISTANCE = "distance"
|
||||
DEVICE_CLASS_DURATION = "duration"
|
||||
DEVICE_CLASS_ENERGY = "energy"
|
||||
DEVICE_CLASS_FREQUENCY = "frequency"
|
||||
|
@ -949,11 +950,14 @@ DEVICE_CLASS_POWER_FACTOR = "power_factor"
|
|||
DEVICE_CLASS_PRESSURE = "pressure"
|
||||
DEVICE_CLASS_REACTIVE_POWER = "reactive_power"
|
||||
DEVICE_CLASS_SIGNAL_STRENGTH = "signal_strength"
|
||||
DEVICE_CLASS_SPEED = "speed"
|
||||
DEVICE_CLASS_SULPHUR_DIOXIDE = "sulphur_dioxide"
|
||||
DEVICE_CLASS_TEMPERATURE = "temperature"
|
||||
DEVICE_CLASS_TIMESTAMP = "timestamp"
|
||||
DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS = "volatile_organic_compounds"
|
||||
DEVICE_CLASS_VOLTAGE = "voltage"
|
||||
DEVICE_CLASS_VOLUME = "volume"
|
||||
DEVICE_CLASS_WEIGHT = "weight"
|
||||
# device classes of both binary_sensor and button component
|
||||
DEVICE_CLASS_UPDATE = "update"
|
||||
# device classes of button component
|
||||
|
|
Loading…
Reference in a new issue