/
/
/
1"""Device configuration handler."""
2
3from __future__ import annotations
4
5from pywam.lib.exceptions import FeatureNotSupportedError
6
7from music_assistant.providers.samsung_wam.features.base import (
8 WamPlayerFeatureBase,
9 handle_pywam_errors,
10 retry_command,
11)
12
13
14class DeviceConfigHandler(WamPlayerFeatureBase):
15 """Encapsulates device configuration commands."""
16
17 @retry_command()
18 @handle_pywam_errors
19 async def set_name(self, name: str) -> None:
20 """
21 Set the friendly name on the device.
22
23 :param name: The desired friendly name.
24 """
25 try:
26 await self.speaker.set_name(name)
27 except FeatureNotSupportedError:
28 # pywam raises this when the speaker is grouped or not yet fully initialised
29 self.logger.debug("Cannot rename %s in its current mode", self.player.log_name)
30