Add icon translations to Idasen desk (#111813)
parent
677e12b033
commit
689651ee2c
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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,
|
||||
|
|
|
@ -21,6 +21,14 @@
|
|||
}
|
||||
},
|
||||
"entity": {
|
||||
"button": {
|
||||
"connect": {
|
||||
"name": "Connect"
|
||||
},
|
||||
"disconnect": {
|
||||
"name": "Disconnect"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"height": {
|
||||
"name": "Height"
|
||||
|
|
Loading…
Reference in New Issue