From f95d649f4496035824864e34828401bf7fe825a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85ke=20Strandberg?= Date: Fri, 15 Mar 2024 00:47:10 +0100 Subject: [PATCH] Add icon translations to myuplink (#111466) --- .../components/myuplink/binary_sensor.py | 2 +- homeassistant/components/myuplink/icons.json | 45 +++++++++++++++++++ homeassistant/components/myuplink/number.py | 4 +- homeassistant/components/myuplink/sensor.py | 10 ++--- homeassistant/components/myuplink/switch.py | 6 ++- tests/components/myuplink/test_number.py | 1 - tests/components/myuplink/test_switch.py | 1 - 7 files changed, 58 insertions(+), 11 deletions(-) create mode 100644 homeassistant/components/myuplink/icons.json diff --git a/homeassistant/components/myuplink/binary_sensor.py b/homeassistant/components/myuplink/binary_sensor.py index b5ade88a002..38b8c9c5fd3 100644 --- a/homeassistant/components/myuplink/binary_sensor.py +++ b/homeassistant/components/myuplink/binary_sensor.py @@ -20,7 +20,7 @@ CATEGORY_BASED_DESCRIPTIONS: dict[str, dict[str, BinarySensorEntityDescription]] "NIBEF": { "43161": BinarySensorEntityDescription( key="elect_add", - icon="mdi:electric-switch", + translation_key="elect_add", ), }, } diff --git a/homeassistant/components/myuplink/icons.json b/homeassistant/components/myuplink/icons.json new file mode 100644 index 00000000000..580b83b1b15 --- /dev/null +++ b/homeassistant/components/myuplink/icons.json @@ -0,0 +1,45 @@ +{ + "entity": { + "binary_sensor": { + "elect_add": { + "default": "mdi:electric-switch", + "state": { + "on": "mdi:electric-switch-closed" + } + } + }, + "number": { + "degree_minutes": { + "default": "mdi:thermometer-lines" + } + }, + "sensor": { + "airflow": { + "default": "mdi:weather-windy" + }, + "elect_add": { + "default": "mdi:heat-wave" + }, + "fan_mode": { + "default": "mdi:fan" + }, + "priority": { + "default": "mdi:priority-high" + }, + "status_compressor": { + "default": "mdi:heat-pump-outline" + } + }, + "switch": { + "boost_ventilation": { + "default": "mdi:fan-plus" + }, + "temporary_lux": { + "default": "mdi:water-alert-outline", + "state": { + "on": "mdi:water-alert" + } + } + } + } +} diff --git a/homeassistant/components/myuplink/number.py b/homeassistant/components/myuplink/number.py index 55662fb57fb..4e947a440dd 100644 --- a/homeassistant/components/myuplink/number.py +++ b/homeassistant/components/myuplink/number.py @@ -18,7 +18,7 @@ from .helpers import find_matching_platform DEVICE_POINT_UNIT_DESCRIPTIONS: dict[str, NumberEntityDescription] = { "DM": NumberEntityDescription( key="degree_minutes", - icon="mdi:thermometer-lines", + translation_key="degree_minutes", native_unit_of_measurement="DM", ), } @@ -27,7 +27,7 @@ CATEGORY_BASED_DESCRIPTIONS: dict[str, dict[str, NumberEntityDescription]] = { "NIBEF": { "40940": NumberEntityDescription( key="degree_minutes", - icon="mdi:thermometer-lines", + translation_key="degree_minutes", native_unit_of_measurement="DM", ), }, diff --git a/homeassistant/components/myuplink/sensor.py b/homeassistant/components/myuplink/sensor.py index 1e4bfed1a20..a7afa8f28d8 100644 --- a/homeassistant/components/myuplink/sensor.py +++ b/homeassistant/components/myuplink/sensor.py @@ -81,10 +81,10 @@ DEVICE_POINT_UNIT_DESCRIPTIONS: dict[str, SensorEntityDescription] = { ), "m3/h": SensorEntityDescription( key="airflow", + translation_key="airflow", device_class=SensorDeviceClass.VOLUME_FLOW_RATE, state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR, - icon="mdi:weather-windy", ), "s": SensorEntityDescription( key="seconds", @@ -101,22 +101,22 @@ CATEGORY_BASED_DESCRIPTIONS: dict[str, dict[str, SensorEntityDescription]] = { "NIBEF": { "43108": SensorEntityDescription( key="fan_mode", - icon="mdi:fan", + translation_key="fan_mode", ), "43427": SensorEntityDescription( key="status_compressor", + translation_key="status_compressor", device_class=SensorDeviceClass.ENUM, - icon="mdi:heat-pump-outline", ), "49993": SensorEntityDescription( key="elect_add", + translation_key="elect_add", device_class=SensorDeviceClass.ENUM, - icon="mdi:heat-wave", ), "49994": SensorEntityDescription( key="priority", + translation_key="priority", device_class=SensorDeviceClass.ENUM, - icon="mdi:priority-high", ), }, "NIBE": {}, diff --git a/homeassistant/components/myuplink/switch.py b/homeassistant/components/myuplink/switch.py index 310c6417133..5f6bee2262e 100644 --- a/homeassistant/components/myuplink/switch.py +++ b/homeassistant/components/myuplink/switch.py @@ -21,7 +21,11 @@ CATEGORY_BASED_DESCRIPTIONS: dict[str, dict[str, SwitchEntityDescription]] = { "NIBEF": { "50004": SwitchEntityDescription( key="temporary_lux", - icon="mdi:water-alert-outline", + translation_key="temporary_lux", + ), + "50005": SwitchEntityDescription( + key="boost_ventilation", + translation_key="boost_ventilation", ), }, } diff --git a/tests/components/myuplink/test_number.py b/tests/components/myuplink/test_number.py index 09f361f0ec6..2bd2ca61496 100644 --- a/tests/components/myuplink/test_number.py +++ b/tests/components/myuplink/test_number.py @@ -42,7 +42,6 @@ async def test_attributes( assert state.state == "-875.0" assert state.attributes == { "friendly_name": ENTITY_FRIENDLY_NAME, - "icon": "mdi:thermometer-lines", "min": -3000, "max": 3000, "mode": "auto", diff --git a/tests/components/myuplink/test_switch.py b/tests/components/myuplink/test_switch.py index 06855fd91da..e60aa4ebc4b 100644 --- a/tests/components/myuplink/test_switch.py +++ b/tests/components/myuplink/test_switch.py @@ -47,7 +47,6 @@ async def test_attributes( assert state.state == STATE_OFF assert state.attributes == { "friendly_name": ENTITY_FRIENDLY_NAME, - "icon": "mdi:water-alert-outline", }