From 4551954c85e3d3764ecd29a653fa698ed4959b44 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Mon, 3 Jul 2023 03:56:37 +0200 Subject: [PATCH] Add entity translations to LaCrosse View (#95686) --- .../components/lacrosse_view/sensor.py | 20 ++++++--------- .../components/lacrosse_view/strings.json | 25 +++++++++++++++++++ 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/lacrosse_view/sensor.py b/homeassistant/components/lacrosse_view/sensor.py index 833c47dffb0..547772cad09 100644 --- a/homeassistant/components/lacrosse_view/sensor.py +++ b/homeassistant/components/lacrosse_view/sensor.py @@ -67,7 +67,6 @@ SENSOR_DESCRIPTIONS = { "Temperature": LaCrosseSensorEntityDescription( key="Temperature", device_class=SensorDeviceClass.TEMPERATURE, - name="Temperature", state_class=SensorStateClass.MEASUREMENT, value_fn=get_value, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -75,22 +74,20 @@ SENSOR_DESCRIPTIONS = { "Humidity": LaCrosseSensorEntityDescription( key="Humidity", device_class=SensorDeviceClass.HUMIDITY, - name="Humidity", state_class=SensorStateClass.MEASUREMENT, value_fn=get_value, native_unit_of_measurement=PERCENTAGE, ), "HeatIndex": LaCrosseSensorEntityDescription( key="HeatIndex", + translation_key="heat_index", device_class=SensorDeviceClass.TEMPERATURE, - name="Heat index", state_class=SensorStateClass.MEASUREMENT, value_fn=get_value, 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=UnitOfSpeed.KILOMETERS_PER_HOUR, @@ -98,7 +95,6 @@ SENSOR_DESCRIPTIONS = { ), "Rain": LaCrosseSensorEntityDescription( key="Rain", - name="Rain", state_class=SensorStateClass.MEASUREMENT, value_fn=get_value, native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES, @@ -106,23 +102,23 @@ SENSOR_DESCRIPTIONS = { ), "WindHeading": LaCrosseSensorEntityDescription( key="WindHeading", - name="Wind heading", + translation_key="wind_heading", value_fn=get_value, native_unit_of_measurement=DEGREE, ), "WetDry": LaCrosseSensorEntityDescription( key="WetDry", - name="Wet/Dry", + translation_key="wet_dry", value_fn=get_value, ), "Flex": LaCrosseSensorEntityDescription( key="Flex", - name="Flex", + translation_key="flex", value_fn=get_value, ), "BarometricPressure": LaCrosseSensorEntityDescription( key="BarometricPressure", - name="Barometric pressure", + translation_key="barometric_pressure", state_class=SensorStateClass.MEASUREMENT, value_fn=get_value, device_class=SensorDeviceClass.ATMOSPHERIC_PRESSURE, @@ -130,7 +126,7 @@ SENSOR_DESCRIPTIONS = { ), "FeelsLike": LaCrosseSensorEntityDescription( key="FeelsLike", - name="Feels like", + translation_key="feels_like", state_class=SensorStateClass.MEASUREMENT, value_fn=get_value, device_class=SensorDeviceClass.TEMPERATURE, @@ -138,7 +134,7 @@ SENSOR_DESCRIPTIONS = { ), "WindChill": LaCrosseSensorEntityDescription( key="WindChill", - name="Wind chill", + translation_key="wind_chill", state_class=SensorStateClass.MEASUREMENT, value_fn=get_value, device_class=SensorDeviceClass.TEMPERATURE, @@ -193,7 +189,7 @@ class LaCrosseViewSensor( """LaCrosse View sensor.""" entity_description: LaCrosseSensorEntityDescription - _attr_has_entity_name: bool = True + _attr_has_entity_name = True def __init__( self, diff --git a/homeassistant/components/lacrosse_view/strings.json b/homeassistant/components/lacrosse_view/strings.json index 160517793d8..8dc27ba259e 100644 --- a/homeassistant/components/lacrosse_view/strings.json +++ b/homeassistant/components/lacrosse_view/strings.json @@ -17,5 +17,30 @@ "already_configured": "[%key:common::config_flow::abort::already_configured_device%]", "reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]" } + }, + "entity": { + "sensor": { + "heat_index": { + "name": "Heat index" + }, + "wind_heading": { + "name": "Wind heading" + }, + "wet_dry": { + "name": "Wet/Dry" + }, + "flex": { + "name": "Flex" + }, + "barometric_pressure": { + "name": "Barometric pressure" + }, + "feels_like": { + "name": "Feels like" + }, + "wind_chill": { + "name": "Wind chill" + } + } } }