mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Add icon translations to YoLink (#112364)
This commit is contained in:
parent
afdb7d15ca
commit
f81b1819b0
@ -49,7 +49,6 @@ SENSOR_DEVICE_TYPE = [
|
||||
SENSOR_TYPES: tuple[YoLinkBinarySensorEntityDescription, ...] = (
|
||||
YoLinkBinarySensorEntityDescription(
|
||||
key="door_state",
|
||||
icon="mdi:door",
|
||||
device_class=BinarySensorDeviceClass.DOOR,
|
||||
value=lambda value: value == "open" if value is not None else None,
|
||||
exists_fn=lambda device: device.device_type == ATTR_DEVICE_DOOR_SENSOR,
|
||||
|
31
homeassistant/components/yolink/icons.json
Normal file
31
homeassistant/components/yolink/icons.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"entity": {
|
||||
"number": {
|
||||
"config_volume": {
|
||||
"default": "mdi:volume-high"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"power_failure_alarm": {
|
||||
"default": "mdi:flash"
|
||||
},
|
||||
"power_failure_alarm_mute": {
|
||||
"default": "mdi:volume-mute"
|
||||
},
|
||||
"power_failure_alarm_volume": {
|
||||
"default": "mdi:volume-high"
|
||||
},
|
||||
"power_failure_alarm_beep": {
|
||||
"default": "mdi:bullhorn"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"manipulator_state": {
|
||||
"default": "mdi:pipe"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"play_on_speaker_hub": "mdi:speaker"
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ from .const import DOMAIN
|
||||
from .coordinator import YoLinkCoordinator
|
||||
from .entity import YoLinkEntity
|
||||
|
||||
OPTIONS_VALUME = "options_volume"
|
||||
OPTIONS_VOLUME = "options_volume"
|
||||
|
||||
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
@ -49,14 +49,13 @@ def get_volume_value(state: dict[str, Any]) -> int | None:
|
||||
|
||||
DEVICE_CONFIG_DESCRIPTIONS: tuple[YoLinkNumberTypeConfigEntityDescription, ...] = (
|
||||
YoLinkNumberTypeConfigEntityDescription(
|
||||
key=OPTIONS_VALUME,
|
||||
key=OPTIONS_VOLUME,
|
||||
translation_key="config_volume",
|
||||
native_min_value=1,
|
||||
native_max_value=16,
|
||||
mode=NumberMode.SLIDER,
|
||||
native_step=1.0,
|
||||
native_unit_of_measurement=None,
|
||||
icon="mdi:volume-high",
|
||||
exists_fn=lambda device: device.device_type in SUPPORT_SET_VOLUME_DEVICES,
|
||||
should_update_entity=lambda value: value is not None,
|
||||
value=get_volume_value,
|
||||
@ -124,7 +123,7 @@ class YoLinkNumberTypeConfigEntity(YoLinkEntity, NumberEntity):
|
||||
"""Update the current value."""
|
||||
if (
|
||||
self.coordinator.device.device_type == ATTR_DEVICE_SPEAKER_HUB
|
||||
and self.entity_description.key == OPTIONS_VALUME
|
||||
and self.entity_description.key == OPTIONS_VOLUME
|
||||
):
|
||||
await self.update_speaker_hub_volume(value)
|
||||
self._attr_native_value = value
|
||||
|
@ -168,7 +168,6 @@ SENSOR_TYPES: tuple[YoLinkSensorEntityDescription, ...] = (
|
||||
key="state",
|
||||
translation_key="power_failure_alarm",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
icon="mdi:flash",
|
||||
options=["normal", "alert", "off"],
|
||||
exists_fn=lambda device: device.device_type in ATTR_DEVICE_POWER_FAILURE_ALARM,
|
||||
),
|
||||
@ -176,7 +175,6 @@ SENSOR_TYPES: tuple[YoLinkSensorEntityDescription, ...] = (
|
||||
key="mute",
|
||||
translation_key="power_failure_alarm_mute",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
icon="mdi:volume-mute",
|
||||
options=["muted", "unmuted"],
|
||||
exists_fn=lambda device: device.device_type in ATTR_DEVICE_POWER_FAILURE_ALARM,
|
||||
value=lambda value: "muted" if value is True else "unmuted",
|
||||
@ -185,7 +183,6 @@ SENSOR_TYPES: tuple[YoLinkSensorEntityDescription, ...] = (
|
||||
key="sound",
|
||||
translation_key="power_failure_alarm_volume",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
icon="mdi:volume-high",
|
||||
options=["low", "medium", "high"],
|
||||
exists_fn=lambda device: device.device_type in ATTR_DEVICE_POWER_FAILURE_ALARM,
|
||||
value=cvt_volume,
|
||||
@ -194,7 +191,6 @@ SENSOR_TYPES: tuple[YoLinkSensorEntityDescription, ...] = (
|
||||
key="beep",
|
||||
translation_key="power_failure_alarm_beep",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
icon="mdi:bullhorn",
|
||||
options=["enabled", "disabled"],
|
||||
exists_fn=lambda device: device.device_type in ATTR_DEVICE_POWER_FAILURE_ALARM,
|
||||
value=lambda value: "enabled" if value is True else "disabled",
|
||||
|
@ -46,8 +46,8 @@ DEVICE_TYPES: tuple[YoLinkSwitchEntityDescription, ...] = (
|
||||
),
|
||||
YoLinkSwitchEntityDescription(
|
||||
key="manipulator_state",
|
||||
translation_key="manipulator_state",
|
||||
name=None,
|
||||
icon="mdi:pipe",
|
||||
exists_fn=lambda device: device.device_type == ATTR_DEVICE_MANIPULATOR,
|
||||
),
|
||||
YoLinkSwitchEntityDescription(
|
||||
|
Loading…
x
Reference in New Issue
Block a user