mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use new device class in tellduslive (#83369)
This commit is contained in:
parent
c4326ed1ef
commit
3ba264c318
@ -10,13 +10,14 @@ from homeassistant.components.sensor import (
|
|||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
LENGTH_MILLIMETERS,
|
|
||||||
LIGHT_LUX,
|
LIGHT_LUX,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_WATT,
|
|
||||||
SPEED_METERS_PER_SECOND,
|
|
||||||
TEMP_CELSIUS,
|
|
||||||
UV_INDEX,
|
UV_INDEX,
|
||||||
|
UnitOfPower,
|
||||||
|
UnitOfPrecipitationDepth,
|
||||||
|
UnitOfPressure,
|
||||||
|
UnitOfSpeed,
|
||||||
|
UnitOfTemperature,
|
||||||
UnitOfVolumetricFlux,
|
UnitOfVolumetricFlux,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -43,7 +44,7 @@ SENSOR_TYPES: dict[str, SensorEntityDescription] = {
|
|||||||
SENSOR_TYPE_TEMPERATURE: SensorEntityDescription(
|
SENSOR_TYPE_TEMPERATURE: SensorEntityDescription(
|
||||||
key=SENSOR_TYPE_TEMPERATURE,
|
key=SENSOR_TYPE_TEMPERATURE,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
@ -64,8 +65,8 @@ SENSOR_TYPES: dict[str, SensorEntityDescription] = {
|
|||||||
SENSOR_TYPE_RAINTOTAL: SensorEntityDescription(
|
SENSOR_TYPE_RAINTOTAL: SensorEntityDescription(
|
||||||
key=SENSOR_TYPE_RAINTOTAL,
|
key=SENSOR_TYPE_RAINTOTAL,
|
||||||
name="Rain total",
|
name="Rain total",
|
||||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||||
icon="mdi:water",
|
device_class=SensorDeviceClass.PRECIPITATION,
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
),
|
),
|
||||||
SENSOR_TYPE_WINDDIRECTION: SensorEntityDescription(
|
SENSOR_TYPE_WINDDIRECTION: SensorEntityDescription(
|
||||||
@ -75,15 +76,15 @@ SENSOR_TYPES: dict[str, SensorEntityDescription] = {
|
|||||||
SENSOR_TYPE_WINDAVERAGE: SensorEntityDescription(
|
SENSOR_TYPE_WINDAVERAGE: SensorEntityDescription(
|
||||||
key=SENSOR_TYPE_WINDAVERAGE,
|
key=SENSOR_TYPE_WINDAVERAGE,
|
||||||
name="Wind average",
|
name="Wind average",
|
||||||
native_unit_of_measurement=SPEED_METERS_PER_SECOND,
|
native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND,
|
||||||
device_class=SensorDeviceClass.SPEED,
|
device_class=SensorDeviceClass.WIND_SPEED,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SENSOR_TYPE_WINDGUST: SensorEntityDescription(
|
SENSOR_TYPE_WINDGUST: SensorEntityDescription(
|
||||||
key=SENSOR_TYPE_WINDGUST,
|
key=SENSOR_TYPE_WINDGUST,
|
||||||
name="Wind gust",
|
name="Wind gust",
|
||||||
native_unit_of_measurement=SPEED_METERS_PER_SECOND,
|
native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND,
|
||||||
device_class=SensorDeviceClass.SPEED,
|
device_class=SensorDeviceClass.WIND_SPEED,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SENSOR_TYPE_UV: SensorEntityDescription(
|
SENSOR_TYPE_UV: SensorEntityDescription(
|
||||||
@ -95,7 +96,8 @@ SENSOR_TYPES: dict[str, SensorEntityDescription] = {
|
|||||||
SENSOR_TYPE_WATT: SensorEntityDescription(
|
SENSOR_TYPE_WATT: SensorEntityDescription(
|
||||||
key=SENSOR_TYPE_WATT,
|
key=SENSOR_TYPE_WATT,
|
||||||
name="Power",
|
name="Power",
|
||||||
native_unit_of_measurement=POWER_WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
|
device_class=SensorDeviceClass.POWER,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SENSOR_TYPE_LUMINANCE: SensorEntityDescription(
|
SENSOR_TYPE_LUMINANCE: SensorEntityDescription(
|
||||||
@ -108,14 +110,14 @@ SENSOR_TYPES: dict[str, SensorEntityDescription] = {
|
|||||||
SENSOR_TYPE_DEW_POINT: SensorEntityDescription(
|
SENSOR_TYPE_DEW_POINT: SensorEntityDescription(
|
||||||
key=SENSOR_TYPE_DEW_POINT,
|
key=SENSOR_TYPE_DEW_POINT,
|
||||||
name="Dew Point",
|
name="Dew Point",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SENSOR_TYPE_BAROMETRIC_PRESSURE: SensorEntityDescription(
|
SENSOR_TYPE_BAROMETRIC_PRESSURE: SensorEntityDescription(
|
||||||
key=SENSOR_TYPE_BAROMETRIC_PRESSURE,
|
key=SENSOR_TYPE_BAROMETRIC_PRESSURE,
|
||||||
name="Barometric Pressure",
|
name="Barometric Pressure",
|
||||||
native_unit_of_measurement="kPa",
|
native_unit_of_measurement=UnitOfPressure.KPA,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user