From 689651ee2cbe6c31d7343ae1d21d55c669cf5fe1 Mon Sep 17 00:00:00 2001
From: Joost Lekkerkerker <joostlek@outlook.com>
Date: Fri, 1 Mar 2024 12:42:26 +0100
Subject: [PATCH] Add icon translations to Idasen desk (#111813)

---
 .../components/idasen_desk/button.py          | 16 ++++----------
 homeassistant/components/idasen_desk/cover.py |  6 ++---
 .../components/idasen_desk/icons.json         | 22 +++++++++++++++++++
 .../components/idasen_desk/sensor.py          |  1 -
 .../components/idasen_desk/strings.json       |  8 +++++++
 5 files changed, 37 insertions(+), 16 deletions(-)
 create mode 100644 homeassistant/components/idasen_desk/icons.json

diff --git a/homeassistant/components/idasen_desk/button.py b/homeassistant/components/idasen_desk/button.py
index d11738c6bcd..1887ffe438b 100644
--- a/homeassistant/components/idasen_desk/button.py
+++ b/homeassistant/components/idasen_desk/button.py
@@ -4,11 +4,7 @@ from dataclasses import dataclass
 import logging
 from typing import Any, Final
 
-from homeassistant.components.button import (
-    ButtonDeviceClass,
-    ButtonEntity,
-    ButtonEntityDescription,
-)
+from homeassistant.components.button import ButtonEntity, ButtonEntityDescription
 from homeassistant.config_entries import ConfigEntry
 from homeassistant.const import EntityCategory
 from homeassistant.core import HomeAssistant
@@ -40,17 +36,13 @@ class IdasenDeskButtonDescription(
 BUTTONS: Final = [
     IdasenDeskButtonDescription(
         key="connect",
-        name="Connect",
-        icon="mdi:bluetooth-connect",
-        device_class=ButtonDeviceClass.RESTART,
+        translation_key="connect",
         entity_category=EntityCategory.CONFIG,
         press_action=lambda coordinator: coordinator.async_connect,
     ),
     IdasenDeskButtonDescription(
         key="disconnect",
-        name="Disconnect",
-        icon="mdi:bluetooth-off",
-        device_class=ButtonDeviceClass.RESTART,
+        translation_key="disconnect",
         entity_category=EntityCategory.CONFIG,
         press_action=lambda coordinator: coordinator.async_disconnect,
     ),
@@ -86,7 +78,7 @@ class IdasenDeskButton(ButtonEntity):
         """Initialize the IdasenDesk button entity."""
         self.entity_description = description
 
-        self._attr_unique_id = f"{self.entity_description.key}-{address}"
+        self._attr_unique_id = f"{description.key}-{address}"
         self._attr_device_info = device_info
         self._address = address
         self._coordinator = coordinator
diff --git a/homeassistant/components/idasen_desk/cover.py b/homeassistant/components/idasen_desk/cover.py
index 1daebe52420..a29d2557f93 100644
--- a/homeassistant/components/idasen_desk/cover.py
+++ b/homeassistant/components/idasen_desk/cover.py
@@ -12,7 +12,6 @@ from homeassistant.components.cover import (
     CoverEntityFeature,
 )
 from homeassistant.config_entries import ConfigEntry
-from homeassistant.const import ATTR_NAME
 from homeassistant.core import HomeAssistant, callback
 from homeassistant.exceptions import HomeAssistantError
 from homeassistant.helpers.device_registry import DeviceInfo
@@ -39,13 +38,15 @@ class IdasenDeskCover(CoordinatorEntity[IdasenDeskCoordinator], CoverEntity):
     """Representation of Idasen Desk device."""
 
     _attr_device_class = CoverDeviceClass.DAMPER
-    _attr_icon = "mdi:desk"
     _attr_supported_features = (
         CoverEntityFeature.OPEN
         | CoverEntityFeature.CLOSE
         | CoverEntityFeature.STOP
         | CoverEntityFeature.SET_POSITION
     )
+    _attr_has_entity_name = True
+    _attr_name = None
+    _attr_translation_key = "desk"
 
     def __init__(
         self,
@@ -56,7 +57,6 @@ class IdasenDeskCover(CoordinatorEntity[IdasenDeskCoordinator], CoverEntity):
         """Initialize an Idasen Desk cover."""
         super().__init__(coordinator)
         self._desk = coordinator.desk
-        self._attr_name = device_info[ATTR_NAME]
         self._attr_unique_id = address
         self._attr_device_info = device_info
 
diff --git a/homeassistant/components/idasen_desk/icons.json b/homeassistant/components/idasen_desk/icons.json
new file mode 100644
index 00000000000..8feca3de25d
--- /dev/null
+++ b/homeassistant/components/idasen_desk/icons.json
@@ -0,0 +1,22 @@
+{
+  "entity": {
+    "button": {
+      "connect": {
+        "default": "mdi:bluetooth-connect"
+      },
+      "disconnect": {
+        "default": "mdi:bluetooth-off"
+      }
+    },
+    "cover": {
+      "desk": {
+        "default": "mdi:desk"
+      }
+    },
+    "sensor": {
+      "height": {
+        "default": "mdi:arrow-up-down"
+      }
+    }
+  }
+}
diff --git a/homeassistant/components/idasen_desk/sensor.py b/homeassistant/components/idasen_desk/sensor.py
index 0fb3523a461..44a001960c8 100644
--- a/homeassistant/components/idasen_desk/sensor.py
+++ b/homeassistant/components/idasen_desk/sensor.py
@@ -41,7 +41,6 @@ SENSORS = (
     IdasenDeskSensorDescription(
         key="height",
         translation_key="height",
-        icon="mdi:arrow-up-down",
         native_unit_of_measurement=UnitOfLength.METERS,
         device_class=SensorDeviceClass.DISTANCE,
         state_class=SensorStateClass.MEASUREMENT,
diff --git a/homeassistant/components/idasen_desk/strings.json b/homeassistant/components/idasen_desk/strings.json
index 446ef93e542..70e08976925 100644
--- a/homeassistant/components/idasen_desk/strings.json
+++ b/homeassistant/components/idasen_desk/strings.json
@@ -21,6 +21,14 @@
     }
   },
   "entity": {
+    "button": {
+      "connect": {
+        "name": "Connect"
+      },
+      "disconnect": {
+        "name": "Disconnect"
+      }
+    },
     "sensor": {
       "height": {
         "name": "Height"