Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Set volume_step in sonos media_player" #106581

Merged
merged 1 commit into from Dec 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion homeassistant/components/sonos/media_player.py
Expand Up @@ -67,6 +67,7 @@

LONG_SERVICE_TIMEOUT = 30.0
UNJOIN_SERVICE_TIMEOUT = 0.1
VOLUME_INCREMENT = 2

REPEAT_TO_SONOS = {
RepeatMode.OFF: False,
Expand Down Expand Up @@ -211,7 +212,6 @@ class SonosMediaPlayerEntity(SonosEntity, MediaPlayerEntity):
)
_attr_media_content_type = MediaType.MUSIC
_attr_device_class = MediaPlayerDeviceClass.SPEAKER
_attr_volume_step = 2 / 100

def __init__(self, speaker: SonosSpeaker) -> None:
"""Initialize the media player entity."""
Expand Down Expand Up @@ -373,6 +373,16 @@ def source(self) -> str | None:
"""Name of the current input source."""
return self.media.source_name or None

@soco_error()
def volume_up(self) -> None:
"""Volume up media player."""
self.soco.volume += VOLUME_INCREMENT

@soco_error()
def volume_down(self) -> None:
"""Volume down media player."""
self.soco.volume -= VOLUME_INCREMENT

@soco_error()
def set_volume_level(self, volume: float) -> None:
"""Set volume level, range 0..1."""
Expand Down