Use new device class in lacrosse view (#83365)

pull/83362/head
epenet 2022-12-06 10:22:52 +01:00 committed by GitHub
parent 9856a811ae
commit 4f94ad475f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 9 deletions

View File

@ -15,10 +15,9 @@ from homeassistant.components.sensor import (
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
PERCENTAGE,
PRECIPITATION_INCHES,
SPEED_KILOMETERS_PER_HOUR,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
UnitOfPrecipitationDepth,
UnitOfSpeed,
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -57,7 +56,7 @@ SENSOR_DESCRIPTIONS = {
name="Temperature",
state_class=SensorStateClass.MEASUREMENT,
value_fn=get_value,
native_unit_of_measurement=TEMP_CELSIUS,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
),
"Humidity": LaCrosseSensorEntityDescription(
key="Humidity",
@ -73,22 +72,23 @@ SENSOR_DESCRIPTIONS = {
name="Heat index",
state_class=SensorStateClass.MEASUREMENT,
value_fn=get_value,
native_unit_of_measurement=TEMP_FAHRENHEIT,
native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
),
"WindSpeed": LaCrosseSensorEntityDescription(
key="WindSpeed",
name="Wind speed",
state_class=SensorStateClass.MEASUREMENT,
value_fn=get_value,
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
device_class=SensorDeviceClass.SPEED,
native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR,
device_class=SensorDeviceClass.WIND_SPEED,
),
"Rain": LaCrosseSensorEntityDescription(
key="Rain",
name="Rain",
state_class=SensorStateClass.MEASUREMENT,
value_fn=get_value,
native_unit_of_measurement=PRECIPITATION_INCHES,
native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES,
device_class=SensorDeviceClass.PRECIPITATION,
),
}