1
mirror of https://github.com/home-assistant/core synced 2024-10-04 07:58:43 +02:00

Add icon translations to Sonos (#112235)

This commit is contained in:
Joost Lekkerkerker 2024-03-15 16:34:13 +01:00 committed by GitHub
parent 4107cd6ad8
commit 823481063e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 56 additions and 16 deletions

View File

@ -93,7 +93,6 @@ class SonosMicrophoneSensorEntity(SonosEntity, BinarySensorEntity):
"""Representation of a Sonos microphone sensor entity."""
_attr_entity_category = EntityCategory.DIAGNOSTIC
_attr_icon = "mdi:microphone"
_attr_translation_key = "microphone"
def __init__(self, speaker: SonosSpeaker) -> None:

View File

@ -0,0 +1,55 @@
{
"entity": {
"binary_sensor": {
"microphone": {
"default": "mdi:microphone"
}
},
"sensor": {
"audio_input_format": {
"default": "mdi:import"
},
"favorites": {
"default": "mdi:star"
}
},
"switch": {
"loudness": {
"default": "mdi:bullhorn-variant"
},
"surround_mode": {
"default": "mdi:music-note-plus"
},
"night_mode": {
"default": "mdi:chat-sleep"
},
"dialog_level": {
"default": "mdi:ear-hearing"
},
"cross_fade": {
"default": "mdi:swap-horizontal"
},
"status_light": {
"default": "mdi:led-on"
},
"sub_enabled": {
"default": "mdi:dog"
},
"surround_enabled": {
"default": "mdi:surround-sound"
},
"buttons_enabled": {
"default": "mdi:gesture-tap"
}
}
},
"services": {
"snapshot": "mdi:camera",
"restore": "mdi:camera-retake",
"set_sleep_timer": "mdi:alarm",
"clear_sleep_timer": "mdi:alarm-off",
"play_queue": "mdi:play",
"remove_from_queue": "mdi:playlist-remove",
"update_alarm": "mdi:alarm"
}
}

View File

@ -106,7 +106,6 @@ class SonosAudioInputFormatSensorEntity(SonosPollingEntity, SensorEntity):
"""Representation of a Sonos audio import format sensor entity."""
_attr_entity_category = EntityCategory.DIAGNOSTIC
_attr_icon = "mdi:import"
_attr_translation_key = "audio_input_format"
_attr_should_poll = True
@ -135,8 +134,8 @@ class SonosFavoritesEntity(SensorEntity):
"""Representation of a Sonos favorites info entity."""
_attr_entity_registry_enabled_default = False
_attr_icon = "mdi:star"
_attr_name = "Sonos favorites"
_attr_translation_key = "favorites"
_attr_native_unit_of_measurement = "items"
_attr_should_poll = False

View File

@ -68,18 +68,6 @@ POLL_REQUIRED = (
ATTR_STATUS_LIGHT,
)
FEATURE_ICONS = {
ATTR_LOUDNESS: "mdi:bullhorn-variant",
ATTR_MUSIC_PLAYBACK_FULL_VOLUME: "mdi:music-note-plus",
ATTR_NIGHT_SOUND: "mdi:chat-sleep",
ATTR_SPEECH_ENHANCEMENT: "mdi:ear-hearing",
ATTR_CROSSFADE: "mdi:swap-horizontal",
ATTR_STATUS_LIGHT: "mdi:led-on",
ATTR_SUB_ENABLED: "mdi:dog",
ATTR_SURROUND_ENABLED: "mdi:surround-sound",
ATTR_TOUCH_CONTROLS: "mdi:gesture-tap",
}
WEEKEND_DAYS = (0, 6)
@ -147,7 +135,6 @@ class SonosSwitchEntity(SonosPollingEntity, SwitchEntity):
self._attr_entity_category = EntityCategory.CONFIG
self._attr_translation_key = feature_type
self._attr_unique_id = f"{speaker.soco.uid}-{feature_type}"
self._attr_icon = FEATURE_ICONS.get(feature_type)
if feature_type in POLL_REQUIRED:
self._attr_entity_registry_enabled_default = False