From 04be7677a97f6ae2b24159ed913c9631b4377c8e Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Mon, 3 Jul 2023 23:00:12 +0200 Subject: [PATCH] Add entity translations for Open UV (#95810) --- .../components/openuv/binary_sensor.py | 2 +- homeassistant/components/openuv/sensor.py | 20 +++++----- homeassistant/components/openuv/strings.json | 39 +++++++++++++++++++ 3 files changed, 50 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/openuv/binary_sensor.py b/homeassistant/components/openuv/binary_sensor.py index 1e69af66eec..e9f9ee99ff6 100644 --- a/homeassistant/components/openuv/binary_sensor.py +++ b/homeassistant/components/openuv/binary_sensor.py @@ -19,7 +19,7 @@ ATTR_PROTECTION_WINDOW_STARTING_UV = "start_uv" BINARY_SENSOR_DESCRIPTION_PROTECTION_WINDOW = BinarySensorEntityDescription( key=TYPE_PROTECTION_WINDOW, - name="Protection window", + translation_key="protection_window", icon="mdi:sunglasses", ) diff --git a/homeassistant/components/openuv/sensor.py b/homeassistant/components/openuv/sensor.py index 44bde8341a0..90eefac594a 100644 --- a/homeassistant/components/openuv/sensor.py +++ b/homeassistant/components/openuv/sensor.py @@ -49,67 +49,67 @@ UV_LEVEL_LOW = "Low" SENSOR_DESCRIPTIONS = ( SensorEntityDescription( key=TYPE_CURRENT_OZONE_LEVEL, - name="Current ozone level", + translation_key="current_ozone_level", native_unit_of_measurement="du", state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key=TYPE_CURRENT_UV_INDEX, - name="Current UV index", + translation_key="current_uv_index", icon="mdi:weather-sunny", native_unit_of_measurement=UV_INDEX, state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key=TYPE_CURRENT_UV_LEVEL, - name="Current UV level", + translation_key="current_uv_level", icon="mdi:weather-sunny", ), SensorEntityDescription( key=TYPE_MAX_UV_INDEX, - name="Max UV index", + translation_key="max_uv_index", icon="mdi:weather-sunny", native_unit_of_measurement=UV_INDEX, state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key=TYPE_SAFE_EXPOSURE_TIME_1, - name="Skin type 1 safe exposure time", + translation_key="skin_type_1_safe_exposure_time", icon="mdi:timer-outline", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key=TYPE_SAFE_EXPOSURE_TIME_2, - name="Skin type 2 safe exposure time", + translation_key="skin_type_2_safe_exposure_time", icon="mdi:timer-outline", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key=TYPE_SAFE_EXPOSURE_TIME_3, - name="Skin type 3 safe exposure time", + translation_key="skin_type_3_safe_exposure_time", icon="mdi:timer-outline", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key=TYPE_SAFE_EXPOSURE_TIME_4, - name="Skin type 4 safe exposure time", + translation_key="skin_type_4_safe_exposure_time", icon="mdi:timer-outline", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key=TYPE_SAFE_EXPOSURE_TIME_5, - name="Skin type 5 safe exposure time", + translation_key="skin_type_5_safe_exposure_time", icon="mdi:timer-outline", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key=TYPE_SAFE_EXPOSURE_TIME_6, - name="Skin type 6 safe exposure time", + translation_key="skin_type_6_safe_exposure_time", icon="mdi:timer-outline", native_unit_of_measurement=UnitOfTime.MINUTES, state_class=SensorStateClass.MEASUREMENT, diff --git a/homeassistant/components/openuv/strings.json b/homeassistant/components/openuv/strings.json index 9542cb8b1a7..4aa29d11fcf 100644 --- a/homeassistant/components/openuv/strings.json +++ b/homeassistant/components/openuv/strings.json @@ -46,5 +46,44 @@ "title": "The {deprecated_service} service is being removed", "description": "Update any automations or scripts that use this service to instead use the `{alternate_service}` service with `{alternate_targets}` as the target." } + }, + "entity": { + "binary_sensor": { + "protection_window": { + "name": "Protection window" + } + }, + "sensor": { + "current_ozone_level": { + "name": "Current ozone level" + }, + "current_uv_index": { + "name": "Current UV index" + }, + "current_uv_level": { + "name": "Current UV level" + }, + "max_uv_index": { + "name": "Max UV index" + }, + "skin_type_1_safe_exposure_time": { + "name": "Skin type 1 safe exposure time" + }, + "skin_type_2_safe_exposure_time": { + "name": "Skin type 2 safe exposure time" + }, + "skin_type_3_safe_exposure_time": { + "name": "Skin type 3 safe exposure time" + }, + "skin_type_4_safe_exposure_time": { + "name": "Skin type 4 safe exposure time" + }, + "skin_type_5_safe_exposure_time": { + "name": "Skin type 5 safe exposure time" + }, + "skin_type_6_safe_exposure_time": { + "name": "Skin type 6 safe exposure time" + } + } } }