/
/
/
1"""Volume handler."""
2
3from __future__ import annotations
4
5from music_assistant.providers.samsung_wam.features.base import (
6 WamPlayerFeatureBase,
7 handle_pywam_errors,
8 retry_command,
9)
10
11
12class VolumeHandler(WamPlayerFeatureBase):
13 """Encapsulates volume-related commands."""
14
15 @retry_command()
16 @handle_pywam_errors
17 async def set_volume(self, volume_level: int) -> None:
18 """
19 Set the volume level on the speaker.
20
21 :param volume_level: Volume level (0-100).
22 """
23 await self.speaker.set_volume(volume_level)
24
25 @retry_command()
26 @handle_pywam_errors
27 async def set_mute(self, muted: bool) -> None:
28 """
29 Mute or unmute the speaker.
30
31 :param muted: True to mute, False to unmute.
32 """
33 await self.speaker.set_mute(muted)
34