mirror of
https://github.com/home-assistant/core.git
synced 2025-08-05 13:45:12 +02:00
Set suggested display precision in La Crosse View (#138355)
* Set suggested display precision in La Crosse View * Switch to entity descriptions
This commit is contained in:
@@ -64,6 +64,7 @@ SENSOR_DESCRIPTIONS = {
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
value_fn=get_value,
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
suggested_display_precision=2,
|
||||
),
|
||||
"Humidity": LaCrosseSensorEntityDescription(
|
||||
key="Humidity",
|
||||
@@ -71,6 +72,7 @@ SENSOR_DESCRIPTIONS = {
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
value_fn=get_value,
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
suggested_display_precision=2,
|
||||
),
|
||||
"HeatIndex": LaCrosseSensorEntityDescription(
|
||||
key="HeatIndex",
|
||||
@@ -79,6 +81,7 @@ SENSOR_DESCRIPTIONS = {
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
value_fn=get_value,
|
||||
native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
|
||||
suggested_display_precision=2,
|
||||
),
|
||||
"WindSpeed": LaCrosseSensorEntityDescription(
|
||||
key="WindSpeed",
|
||||
@@ -86,6 +89,7 @@ SENSOR_DESCRIPTIONS = {
|
||||
value_fn=get_value,
|
||||
native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR,
|
||||
device_class=SensorDeviceClass.WIND_SPEED,
|
||||
suggested_display_precision=2,
|
||||
),
|
||||
"Rain": LaCrosseSensorEntityDescription(
|
||||
key="Rain",
|
||||
@@ -93,12 +97,14 @@ SENSOR_DESCRIPTIONS = {
|
||||
value_fn=get_value,
|
||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
device_class=SensorDeviceClass.PRECIPITATION,
|
||||
suggested_display_precision=2,
|
||||
),
|
||||
"WindHeading": LaCrosseSensorEntityDescription(
|
||||
key="WindHeading",
|
||||
translation_key="wind_heading",
|
||||
value_fn=get_value,
|
||||
native_unit_of_measurement=DEGREE,
|
||||
suggested_display_precision=2,
|
||||
),
|
||||
"WetDry": LaCrosseSensorEntityDescription(
|
||||
key="WetDry",
|
||||
@@ -117,6 +123,7 @@ SENSOR_DESCRIPTIONS = {
|
||||
value_fn=get_value,
|
||||
device_class=SensorDeviceClass.ATMOSPHERIC_PRESSURE,
|
||||
native_unit_of_measurement=UnitOfPressure.HPA,
|
||||
suggested_display_precision=2,
|
||||
),
|
||||
"FeelsLike": LaCrosseSensorEntityDescription(
|
||||
key="FeelsLike",
|
||||
@@ -125,6 +132,7 @@ SENSOR_DESCRIPTIONS = {
|
||||
value_fn=get_value,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
|
||||
suggested_display_precision=2,
|
||||
),
|
||||
"WindChill": LaCrosseSensorEntityDescription(
|
||||
key="WindChill",
|
||||
@@ -133,6 +141,7 @@ SENSOR_DESCRIPTIONS = {
|
||||
value_fn=get_value,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
|
||||
suggested_display_precision=2,
|
||||
),
|
||||
}
|
||||
# map of API returned unit of measurement strings to their corresponding unit of measurement
|
||||
|
@@ -117,7 +117,7 @@ async def test_field_not_supported(
|
||||
(TEST_STRING_SENSOR, "dry", "wet_dry"),
|
||||
(TEST_ALREADY_FLOAT_SENSOR, "-16.5", "heat_index"),
|
||||
(TEST_ALREADY_INT_SENSOR, "2", "wind_speed"),
|
||||
(TEST_UNITS_OVERRIDE_SENSOR, "-16.6", "temperature"),
|
||||
(TEST_UNITS_OVERRIDE_SENSOR, "-16.6111111111111", "temperature"),
|
||||
],
|
||||
)
|
||||
async def test_field_types(
|
||||
|
Reference in New Issue
Block a user