Migrate Sonos to new entity naming style (#74909)
This commit is contained in:
parent
cdab725bf4
commit
5f728b955e
6 changed files with 15 additions and 20 deletions
|
@ -69,13 +69,13 @@ POLL_REQUIRED = (
|
|||
FRIENDLY_NAMES = {
|
||||
ATTR_CROSSFADE: "Crossfade",
|
||||
ATTR_LOUDNESS: "Loudness",
|
||||
ATTR_MUSIC_PLAYBACK_FULL_VOLUME: "Surround Music Full Volume",
|
||||
ATTR_NIGHT_SOUND: "Night Sound",
|
||||
ATTR_SPEECH_ENHANCEMENT: "Speech Enhancement",
|
||||
ATTR_MUSIC_PLAYBACK_FULL_VOLUME: "Surround music full volume",
|
||||
ATTR_NIGHT_SOUND: "Night sound",
|
||||
ATTR_SPEECH_ENHANCEMENT: "Speech enhancement",
|
||||
ATTR_STATUS_LIGHT: "Status Light",
|
||||
ATTR_SUB_ENABLED: "Subwoofer Enabled",
|
||||
ATTR_SURROUND_ENABLED: "Surround Enabled",
|
||||
ATTR_TOUCH_CONTROLS: "Touch Controls",
|
||||
ATTR_SUB_ENABLED: "Subwoofer enabled",
|
||||
ATTR_SURROUND_ENABLED: "Surround enabled",
|
||||
ATTR_TOUCH_CONTROLS: "Touch controls",
|
||||
}
|
||||
|
||||
FEATURE_ICONS = {
|
||||
|
@ -160,7 +160,7 @@ class SonosSwitchEntity(SonosPollingEntity, SwitchEntity):
|
|||
self.feature_type = feature_type
|
||||
self.needs_coordinator = feature_type in COORDINATOR_FEATURES
|
||||
self._attr_entity_category = EntityCategory.CONFIG
|
||||
self._attr_name = f"{speaker.zone_name} {FRIENDLY_NAMES[feature_type]}"
|
||||
self._attr_name = FRIENDLY_NAMES[feature_type]
|
||||
self._attr_unique_id = f"{speaker.soco.uid}-{feature_type}"
|
||||
self._attr_icon = FEATURE_ICONS.get(feature_type)
|
||||
|
||||
|
@ -240,11 +240,7 @@ class SonosAlarmEntity(SonosEntity, SwitchEntity):
|
|||
@property
|
||||
def name(self) -> str:
|
||||
"""Return the name of the sensor."""
|
||||
return "{} {} Alarm {}".format(
|
||||
self.speaker.zone_name,
|
||||
self.alarm.recurrence.title(),
|
||||
str(self.alarm.start_time)[0:5],
|
||||
)
|
||||
return f"{self.alarm.recurrence.capitalize()} alarm {str(self.alarm.start_time)[:5]}"
|
||||
|
||||
async def _async_fallback_poll(self) -> None:
|
||||
"""Call the central alarm polling method."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue