mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Add icon translations to WLED (#108604)
This commit is contained in:
parent
2a24af14ff
commit
09be3ffc29
68
homeassistant/components/wled/icons.json
Normal file
68
homeassistant/components/wled/icons.json
Normal file
@ -0,0 +1,68 @@
|
||||
{
|
||||
"entity": {
|
||||
"light": {
|
||||
"main": {
|
||||
"default": "mdi:led-strip-variant"
|
||||
},
|
||||
"segment": {
|
||||
"default": "mdi:led-strip-variant"
|
||||
}
|
||||
},
|
||||
"number": {
|
||||
"speed": {
|
||||
"default": "mdi:speedometer"
|
||||
}
|
||||
},
|
||||
"select": {
|
||||
"preset": {
|
||||
"default": "mdi:playlist-play"
|
||||
},
|
||||
"playlist": {
|
||||
"default": "mdi:play-speed"
|
||||
},
|
||||
"color_palette": {
|
||||
"default": "mdi:palette-outline"
|
||||
},
|
||||
"segment_color_palette": {
|
||||
"default": "mdi:palette-outline"
|
||||
},
|
||||
"live_override": {
|
||||
"default": "mdi:theater"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"free_heap": {
|
||||
"default": "mdi:memory"
|
||||
},
|
||||
"wifi_signal": {
|
||||
"default": "mdi:wifi"
|
||||
},
|
||||
"wifi_channel": {
|
||||
"default": "mdi:wifi"
|
||||
},
|
||||
"wifi_bssid": {
|
||||
"default": "mdi:wifi"
|
||||
},
|
||||
"ip": {
|
||||
"default": "mdi:ip-network"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
"nightlight": {
|
||||
"default": "mdi:weather-night"
|
||||
},
|
||||
"sync_send": {
|
||||
"default": "mdi:upload-network-outline"
|
||||
},
|
||||
"sync_receive": {
|
||||
"default": "mdi:download-network-outline"
|
||||
},
|
||||
"reverse": {
|
||||
"default": "mdi:swap-horizontal-bold"
|
||||
},
|
||||
"segment_reverse": {
|
||||
"default": "mdi:swap-horizontal-bold"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -51,7 +51,6 @@ class WLEDMainLight(WLEDEntity, LightEntity):
|
||||
"""Defines a WLED main light."""
|
||||
|
||||
_attr_color_mode = ColorMode.BRIGHTNESS
|
||||
_attr_icon = "mdi:led-strip-variant"
|
||||
_attr_translation_key = "main"
|
||||
_attr_supported_features = LightEntityFeature.TRANSITION
|
||||
_attr_supported_color_modes = {ColorMode.BRIGHTNESS}
|
||||
@ -103,7 +102,7 @@ class WLEDSegmentLight(WLEDEntity, LightEntity):
|
||||
"""Defines a WLED light based on a segment."""
|
||||
|
||||
_attr_supported_features = LightEntityFeature.EFFECT | LightEntityFeature.TRANSITION
|
||||
_attr_icon = "mdi:led-strip-variant"
|
||||
_attr_translation_key = "segment"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@ -121,7 +120,6 @@ class WLEDSegmentLight(WLEDEntity, LightEntity):
|
||||
if segment == 0:
|
||||
self._attr_name = None
|
||||
else:
|
||||
self._attr_translation_key = "segment"
|
||||
self._attr_translation_placeholders = {"segment": str(segment)}
|
||||
|
||||
self._attr_unique_id = (
|
||||
|
@ -50,7 +50,6 @@ NUMBERS = [
|
||||
WLEDNumberEntityDescription(
|
||||
key=ATTR_SPEED,
|
||||
translation_key="speed",
|
||||
icon="mdi:speedometer",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
native_step=1,
|
||||
native_min_value=0,
|
||||
|
@ -49,7 +49,6 @@ class WLEDLiveOverrideSelect(WLEDEntity, SelectEntity):
|
||||
"""Defined a WLED Live Override select."""
|
||||
|
||||
_attr_entity_category = EntityCategory.CONFIG
|
||||
_attr_icon = "mdi:theater"
|
||||
_attr_translation_key = "live_override"
|
||||
|
||||
def __init__(self, coordinator: WLEDDataUpdateCoordinator) -> None:
|
||||
@ -73,7 +72,6 @@ class WLEDLiveOverrideSelect(WLEDEntity, SelectEntity):
|
||||
class WLEDPresetSelect(WLEDEntity, SelectEntity):
|
||||
"""Defined a WLED Preset select."""
|
||||
|
||||
_attr_icon = "mdi:playlist-play"
|
||||
_attr_translation_key = "preset"
|
||||
|
||||
def __init__(self, coordinator: WLEDDataUpdateCoordinator) -> None:
|
||||
@ -104,7 +102,6 @@ class WLEDPresetSelect(WLEDEntity, SelectEntity):
|
||||
class WLEDPlaylistSelect(WLEDEntity, SelectEntity):
|
||||
"""Define a WLED Playlist select."""
|
||||
|
||||
_attr_icon = "mdi:play-speed"
|
||||
_attr_translation_key = "playlist"
|
||||
|
||||
def __init__(self, coordinator: WLEDDataUpdateCoordinator) -> None:
|
||||
@ -138,7 +135,6 @@ class WLEDPaletteSelect(WLEDEntity, SelectEntity):
|
||||
"""Defines a WLED Palette select."""
|
||||
|
||||
_attr_entity_category = EntityCategory.CONFIG
|
||||
_attr_icon = "mdi:palette-outline"
|
||||
_attr_translation_key = "color_palette"
|
||||
_segment: int
|
||||
|
||||
|
@ -76,7 +76,6 @@ SENSORS: tuple[WLEDSensorEntityDescription, ...] = (
|
||||
WLEDSensorEntityDescription(
|
||||
key="free_heap",
|
||||
translation_key="free_heap",
|
||||
icon="mdi:memory",
|
||||
native_unit_of_measurement=UnitOfInformation.BYTES,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
device_class=SensorDeviceClass.DATA_SIZE,
|
||||
@ -87,7 +86,6 @@ SENSORS: tuple[WLEDSensorEntityDescription, ...] = (
|
||||
WLEDSensorEntityDescription(
|
||||
key="wifi_signal",
|
||||
translation_key="wifi_signal",
|
||||
icon="mdi:wifi",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
@ -107,7 +105,6 @@ SENSORS: tuple[WLEDSensorEntityDescription, ...] = (
|
||||
WLEDSensorEntityDescription(
|
||||
key="wifi_channel",
|
||||
translation_key="wifi_channel",
|
||||
icon="mdi:wifi",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
entity_registry_enabled_default=False,
|
||||
value_fn=lambda device: device.info.wifi.channel if device.info.wifi else None,
|
||||
@ -115,7 +112,6 @@ SENSORS: tuple[WLEDSensorEntityDescription, ...] = (
|
||||
WLEDSensorEntityDescription(
|
||||
key="wifi_bssid",
|
||||
translation_key="wifi_bssid",
|
||||
icon="mdi:wifi",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
entity_registry_enabled_default=False,
|
||||
value_fn=lambda device: device.info.wifi.bssid if device.info.wifi else None,
|
||||
@ -123,7 +119,6 @@ SENSORS: tuple[WLEDSensorEntityDescription, ...] = (
|
||||
WLEDSensorEntityDescription(
|
||||
key="ip",
|
||||
translation_key="ip",
|
||||
icon="mdi:ip-network",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda device: device.info.ip,
|
||||
),
|
||||
|
@ -53,7 +53,6 @@ async def async_setup_entry(
|
||||
class WLEDNightlightSwitch(WLEDEntity, SwitchEntity):
|
||||
"""Defines a WLED nightlight switch."""
|
||||
|
||||
_attr_icon = "mdi:weather-night"
|
||||
_attr_entity_category = EntityCategory.CONFIG
|
||||
_attr_translation_key = "nightlight"
|
||||
|
||||
@ -91,7 +90,6 @@ class WLEDNightlightSwitch(WLEDEntity, SwitchEntity):
|
||||
class WLEDSyncSendSwitch(WLEDEntity, SwitchEntity):
|
||||
"""Defines a WLED sync send switch."""
|
||||
|
||||
_attr_icon = "mdi:upload-network-outline"
|
||||
_attr_entity_category = EntityCategory.CONFIG
|
||||
_attr_translation_key = "sync_send"
|
||||
|
||||
@ -124,7 +122,6 @@ class WLEDSyncSendSwitch(WLEDEntity, SwitchEntity):
|
||||
class WLEDSyncReceiveSwitch(WLEDEntity, SwitchEntity):
|
||||
"""Defines a WLED sync receive switch."""
|
||||
|
||||
_attr_icon = "mdi:download-network-outline"
|
||||
_attr_entity_category = EntityCategory.CONFIG
|
||||
_attr_translation_key = "sync_receive"
|
||||
|
||||
@ -157,7 +154,6 @@ class WLEDSyncReceiveSwitch(WLEDEntity, SwitchEntity):
|
||||
class WLEDReverseSwitch(WLEDEntity, SwitchEntity):
|
||||
"""Defines a WLED reverse effect switch."""
|
||||
|
||||
_attr_icon = "mdi:swap-horizontal-bold"
|
||||
_attr_entity_category = EntityCategory.CONFIG
|
||||
_attr_translation_key = "reverse"
|
||||
_segment: int
|
||||
|
@ -87,7 +87,6 @@
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'WLED RGB Light Segment 1 speed',
|
||||
'icon': 'mdi:speedometer',
|
||||
'max': 255,
|
||||
'min': 0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
@ -126,7 +125,7 @@
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:speedometer',
|
||||
'original_icon': None,
|
||||
'original_name': 'Segment 1 speed',
|
||||
'platform': 'wled',
|
||||
'previous_unique_id': None,
|
||||
|
@ -3,7 +3,6 @@
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'WLED RGB Light Live override',
|
||||
'icon': 'mdi:theater',
|
||||
'options': list([
|
||||
'0',
|
||||
'1',
|
||||
@ -44,7 +43,7 @@
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:theater',
|
||||
'original_icon': None,
|
||||
'original_name': 'Live override',
|
||||
'platform': 'wled',
|
||||
'previous_unique_id': None,
|
||||
@ -90,7 +89,6 @@
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'WLED RGB Light Segment 1 color palette',
|
||||
'icon': 'mdi:palette-outline',
|
||||
'options': list([
|
||||
'Analogous',
|
||||
'April Night',
|
||||
@ -225,7 +223,7 @@
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:palette-outline',
|
||||
'original_icon': None,
|
||||
'original_name': 'Segment 1 color palette',
|
||||
'platform': 'wled',
|
||||
'previous_unique_id': None,
|
||||
@ -271,7 +269,6 @@
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'WLED RGBW Light Playlist',
|
||||
'icon': 'mdi:play-speed',
|
||||
'options': list([
|
||||
'Playlist 1',
|
||||
'Playlist 2',
|
||||
@ -310,7 +307,7 @@
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:play-speed',
|
||||
'original_icon': None,
|
||||
'original_name': 'Playlist',
|
||||
'platform': 'wled',
|
||||
'previous_unique_id': None,
|
||||
@ -356,7 +353,6 @@
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'WLED RGBW Light Preset',
|
||||
'icon': 'mdi:playlist-play',
|
||||
'options': list([
|
||||
'Preset 1',
|
||||
'Preset 2',
|
||||
@ -395,7 +391,7 @@
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:playlist-play',
|
||||
'original_icon': None,
|
||||
'original_name': 'Preset',
|
||||
'platform': 'wled',
|
||||
'previous_unique_id': None,
|
||||
|
@ -5,7 +5,6 @@
|
||||
'duration': 60,
|
||||
'fade': True,
|
||||
'friendly_name': 'WLED RGB Light Nightlight',
|
||||
'icon': 'mdi:weather-night',
|
||||
'target_brightness': 0,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
@ -36,7 +35,7 @@
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:weather-night',
|
||||
'original_icon': None,
|
||||
'original_name': 'Nightlight',
|
||||
'platform': 'wled',
|
||||
'previous_unique_id': None,
|
||||
@ -82,7 +81,6 @@
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'WLED RGB Light Reverse',
|
||||
'icon': 'mdi:swap-horizontal-bold',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.wled_rgb_light_reverse',
|
||||
@ -112,7 +110,7 @@
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:swap-horizontal-bold',
|
||||
'original_icon': None,
|
||||
'original_name': 'Reverse',
|
||||
'platform': 'wled',
|
||||
'previous_unique_id': None,
|
||||
@ -158,7 +156,6 @@
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'WLED RGB Light Sync receive',
|
||||
'icon': 'mdi:download-network-outline',
|
||||
'udp_port': 21324,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
@ -189,7 +186,7 @@
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:download-network-outline',
|
||||
'original_icon': None,
|
||||
'original_name': 'Sync receive',
|
||||
'platform': 'wled',
|
||||
'previous_unique_id': None,
|
||||
@ -235,7 +232,6 @@
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'WLED RGB Light Sync send',
|
||||
'icon': 'mdi:upload-network-outline',
|
||||
'udp_port': 21324,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
@ -266,7 +262,7 @@
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:upload-network-outline',
|
||||
'original_icon': None,
|
||||
'original_name': 'Sync send',
|
||||
'platform': 'wled',
|
||||
'previous_unique_id': None,
|
||||
|
@ -43,7 +43,7 @@ async def test_rgb_light_state(
|
||||
assert state.attributes.get(ATTR_BRIGHTNESS) == 127
|
||||
assert state.attributes.get(ATTR_EFFECT) == "Solid"
|
||||
assert state.attributes.get(ATTR_HS_COLOR) == (37.412, 100.0)
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:led-strip-variant"
|
||||
assert state.attributes.get(ATTR_ICON) is None
|
||||
assert state.state == STATE_ON
|
||||
|
||||
assert (entry := entity_registry.async_get("light.wled_rgb_light"))
|
||||
@ -54,7 +54,7 @@ async def test_rgb_light_state(
|
||||
assert state.attributes.get(ATTR_BRIGHTNESS) == 127
|
||||
assert state.attributes.get(ATTR_EFFECT) == "Blink"
|
||||
assert state.attributes.get(ATTR_HS_COLOR) == (148.941, 100.0)
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:led-strip-variant"
|
||||
assert state.attributes.get(ATTR_ICON) is None
|
||||
assert state.state == STATE_ON
|
||||
|
||||
assert (entry := entity_registry.async_get("light.wled_rgb_light_segment_1"))
|
||||
|
@ -61,7 +61,7 @@ async def test_sensors(
|
||||
assert entry.entity_category is EntityCategory.DIAGNOSTIC
|
||||
|
||||
assert (state := hass.states.get("sensor.wled_rgb_light_free_memory"))
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:memory"
|
||||
assert state.attributes.get(ATTR_ICON) is None
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfInformation.BYTES
|
||||
assert state.state == "14600"
|
||||
assert entry.entity_category is EntityCategory.DIAGNOSTIC
|
||||
@ -71,7 +71,7 @@ async def test_sensors(
|
||||
assert entry.entity_category is EntityCategory.DIAGNOSTIC
|
||||
|
||||
assert (state := hass.states.get("sensor.wled_rgb_light_wi_fi_signal"))
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:wifi"
|
||||
assert state.attributes.get(ATTR_ICON) is None
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||
assert state.state == "76"
|
||||
assert entry.entity_category is EntityCategory.DIAGNOSTIC
|
||||
@ -93,7 +93,7 @@ async def test_sensors(
|
||||
assert entry.entity_category is EntityCategory.DIAGNOSTIC
|
||||
|
||||
assert (state := hass.states.get("sensor.wled_rgb_light_wi_fi_channel"))
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:wifi"
|
||||
assert state.attributes.get(ATTR_ICON) is None
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
|
||||
assert state.state == "11"
|
||||
|
||||
@ -102,7 +102,7 @@ async def test_sensors(
|
||||
assert entry.entity_category is EntityCategory.DIAGNOSTIC
|
||||
|
||||
assert (state := hass.states.get("sensor.wled_rgb_light_wi_fi_bssid"))
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:wifi"
|
||||
assert state.attributes.get(ATTR_ICON) is None
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
|
||||
assert state.state == "AA:AA:AA:AA:AA:BB"
|
||||
|
||||
@ -111,7 +111,7 @@ async def test_sensors(
|
||||
assert entry.entity_category is EntityCategory.DIAGNOSTIC
|
||||
|
||||
assert (state := hass.states.get("sensor.wled_rgb_light_ip"))
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:ip-network"
|
||||
assert state.attributes.get(ATTR_ICON) is None
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) is None
|
||||
assert state.state == "127.0.0.1"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user