mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Add icon translations to Idasen desk (#111813)
This commit is contained in:
parent
677e12b033
commit
689651ee2c
@ -4,11 +4,7 @@ from dataclasses import dataclass
|
|||||||
import logging
|
import logging
|
||||||
from typing import Any, Final
|
from typing import Any, Final
|
||||||
|
|
||||||
from homeassistant.components.button import (
|
from homeassistant.components.button import ButtonEntity, ButtonEntityDescription
|
||||||
ButtonDeviceClass,
|
|
||||||
ButtonEntity,
|
|
||||||
ButtonEntityDescription,
|
|
||||||
)
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import EntityCategory
|
from homeassistant.const import EntityCategory
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -40,17 +36,13 @@ class IdasenDeskButtonDescription(
|
|||||||
BUTTONS: Final = [
|
BUTTONS: Final = [
|
||||||
IdasenDeskButtonDescription(
|
IdasenDeskButtonDescription(
|
||||||
key="connect",
|
key="connect",
|
||||||
name="Connect",
|
translation_key="connect",
|
||||||
icon="mdi:bluetooth-connect",
|
|
||||||
device_class=ButtonDeviceClass.RESTART,
|
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
press_action=lambda coordinator: coordinator.async_connect,
|
press_action=lambda coordinator: coordinator.async_connect,
|
||||||
),
|
),
|
||||||
IdasenDeskButtonDescription(
|
IdasenDeskButtonDescription(
|
||||||
key="disconnect",
|
key="disconnect",
|
||||||
name="Disconnect",
|
translation_key="disconnect",
|
||||||
icon="mdi:bluetooth-off",
|
|
||||||
device_class=ButtonDeviceClass.RESTART,
|
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
press_action=lambda coordinator: coordinator.async_disconnect,
|
press_action=lambda coordinator: coordinator.async_disconnect,
|
||||||
),
|
),
|
||||||
@ -86,7 +78,7 @@ class IdasenDeskButton(ButtonEntity):
|
|||||||
"""Initialize the IdasenDesk button entity."""
|
"""Initialize the IdasenDesk button entity."""
|
||||||
self.entity_description = description
|
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._attr_device_info = device_info
|
||||||
self._address = address
|
self._address = address
|
||||||
self._coordinator = coordinator
|
self._coordinator = coordinator
|
||||||
|
@ -12,7 +12,6 @@ from homeassistant.components.cover import (
|
|||||||
CoverEntityFeature,
|
CoverEntityFeature,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ATTR_NAME
|
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.helpers.device_registry import DeviceInfo
|
from homeassistant.helpers.device_registry import DeviceInfo
|
||||||
@ -39,13 +38,15 @@ class IdasenDeskCover(CoordinatorEntity[IdasenDeskCoordinator], CoverEntity):
|
|||||||
"""Representation of Idasen Desk device."""
|
"""Representation of Idasen Desk device."""
|
||||||
|
|
||||||
_attr_device_class = CoverDeviceClass.DAMPER
|
_attr_device_class = CoverDeviceClass.DAMPER
|
||||||
_attr_icon = "mdi:desk"
|
|
||||||
_attr_supported_features = (
|
_attr_supported_features = (
|
||||||
CoverEntityFeature.OPEN
|
CoverEntityFeature.OPEN
|
||||||
| CoverEntityFeature.CLOSE
|
| CoverEntityFeature.CLOSE
|
||||||
| CoverEntityFeature.STOP
|
| CoverEntityFeature.STOP
|
||||||
| CoverEntityFeature.SET_POSITION
|
| CoverEntityFeature.SET_POSITION
|
||||||
)
|
)
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
_attr_name = None
|
||||||
|
_attr_translation_key = "desk"
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@ -56,7 +57,6 @@ class IdasenDeskCover(CoordinatorEntity[IdasenDeskCoordinator], CoverEntity):
|
|||||||
"""Initialize an Idasen Desk cover."""
|
"""Initialize an Idasen Desk cover."""
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
self._desk = coordinator.desk
|
self._desk = coordinator.desk
|
||||||
self._attr_name = device_info[ATTR_NAME]
|
|
||||||
self._attr_unique_id = address
|
self._attr_unique_id = address
|
||||||
self._attr_device_info = device_info
|
self._attr_device_info = device_info
|
||||||
|
|
||||||
|
22
homeassistant/components/idasen_desk/icons.json
Normal file
22
homeassistant/components/idasen_desk/icons.json
Normal file
@ -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(
|
IdasenDeskSensorDescription(
|
||||||
key="height",
|
key="height",
|
||||||
translation_key="height",
|
translation_key="height",
|
||||||
icon="mdi:arrow-up-down",
|
|
||||||
native_unit_of_measurement=UnitOfLength.METERS,
|
native_unit_of_measurement=UnitOfLength.METERS,
|
||||||
device_class=SensorDeviceClass.DISTANCE,
|
device_class=SensorDeviceClass.DISTANCE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
@ -21,6 +21,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"entity": {
|
"entity": {
|
||||||
|
"button": {
|
||||||
|
"connect": {
|
||||||
|
"name": "Connect"
|
||||||
|
},
|
||||||
|
"disconnect": {
|
||||||
|
"name": "Disconnect"
|
||||||
|
}
|
||||||
|
},
|
||||||
"sensor": {
|
"sensor": {
|
||||||
"height": {
|
"height": {
|
||||||
"name": "Height"
|
"name": "Height"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user