From 32d62e477afe4a1c97f3bd61564e1eb6b140f188 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Sun, 7 Apr 2024 15:54:22 +0200 Subject: [PATCH] Add entity translations to Bluemaestro (#102424) * Add entity translations to Bluemaestro * Fix * yes --- homeassistant/components/bluemaestro/sensor.py | 6 ++---- homeassistant/components/bluemaestro/strings.json | 7 +++++++ .../components/bluemaestro/snapshots/test_sensor.ambr | 10 +++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/bluemaestro/sensor.py b/homeassistant/components/bluemaestro/sensor.py index 4024b8b3326..f8529a4103b 100644 --- a/homeassistant/components/bluemaestro/sensor.py +++ b/homeassistant/components/bluemaestro/sensor.py @@ -75,6 +75,7 @@ SENSOR_DESCRIPTIONS = { ): SensorEntityDescription( key=f"{BlueMaestroSensorDeviceClass.DEW_POINT}_{Units.TEMP_CELSIUS}", device_class=SensorDeviceClass.TEMPERATURE, + translation_key="dew_point", native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, ), @@ -110,10 +111,7 @@ def sensor_update_to_bluetooth_data_update( device_key_to_bluetooth_entity_key(device_key): sensor_values.native_value for device_key, sensor_values in sensor_update.entity_values.items() }, - entity_names={ - device_key_to_bluetooth_entity_key(device_key): sensor_values.name - for device_key, sensor_values in sensor_update.entity_values.items() - }, + entity_names={}, ) diff --git a/homeassistant/components/bluemaestro/strings.json b/homeassistant/components/bluemaestro/strings.json index d1d544c2381..9dc500980a6 100644 --- a/homeassistant/components/bluemaestro/strings.json +++ b/homeassistant/components/bluemaestro/strings.json @@ -18,5 +18,12 @@ "already_in_progress": "[%key:common::config_flow::abort::already_in_progress%]", "already_configured": "[%key:common::config_flow::abort::already_configured_device%]" } + }, + "entity": { + "sensor": { + "dew_point": { + "name": "Dew point" + } + } } } diff --git a/tests/components/bluemaestro/snapshots/test_sensor.ambr b/tests/components/bluemaestro/snapshots/test_sensor.ambr index a86758c709a..2b777ec6f09 100644 --- a/tests/components/bluemaestro/snapshots/test_sensor.ambr +++ b/tests/components/bluemaestro/snapshots/test_sensor.ambr @@ -76,11 +76,11 @@ }), 'original_device_class': , 'original_icon': None, - 'original_name': 'Dew Point', + 'original_name': 'Dew point', 'platform': 'bluemaestro', 'previous_unique_id': None, 'supported_features': 0, - 'translation_key': None, + 'translation_key': 'dew_point', 'unique_id': 'aa:bb:cc:dd:ee:ff-dew_point', 'unit_of_measurement': , }) @@ -89,7 +89,7 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ 'device_class': 'temperature', - 'friendly_name': 'Tempo Disc THD EEFF Dew Point', + 'friendly_name': 'Tempo Disc THD EEFF Dew point', 'state_class': , 'unit_of_measurement': , }), @@ -178,7 +178,7 @@ }), 'original_device_class': , 'original_icon': None, - 'original_name': 'Signal Strength', + 'original_name': 'Signal strength', 'platform': 'bluemaestro', 'previous_unique_id': None, 'supported_features': 0, @@ -191,7 +191,7 @@ StateSnapshot({ 'attributes': ReadOnlyDict({ 'device_class': 'signal_strength', - 'friendly_name': 'Tempo Disc THD EEFF Signal Strength', + 'friendly_name': 'Tempo Disc THD EEFF Signal strength', 'state_class': , 'unit_of_measurement': 'dBm', }),