From e4381f65d4eb98862b4c980e0ab09784da00b0b9 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Tue, 17 Feb 2026 21:20:51 +0100 Subject: [PATCH] Fix webplayer hide from UI by default --- music_assistant/controllers/config.py | 1 + music_assistant/providers/sendspin/player.py | 1 - .../providers/universal_player/player.py | 22 +++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/music_assistant/controllers/config.py b/music_assistant/controllers/config.py index 4a3c818a..d9a2f88a 100644 --- a/music_assistant/controllers/config.py +++ b/music_assistant/controllers/config.py @@ -1870,6 +1870,7 @@ class ConfigController: options=options, category="protocol_general", requires_reload=False, + hidden=len(output_protocols) <= 1, ) ) diff --git a/music_assistant/providers/sendspin/player.py b/music_assistant/providers/sendspin/player.py index 864a931c..91987a35 100644 --- a/music_assistant/providers/sendspin/player.py +++ b/music_assistant/providers/sendspin/player.py @@ -230,7 +230,6 @@ class SendspinPlayer(Player): ) self._attr_expose_to_ha_by_default = not self.is_web_player self._attr_hidden_by_default = self.is_web_player - self._attr_type = PlayerType.PLAYER if self.is_web_player else PlayerType.PROTOCOL def event_cb(self, client: SendspinClient, event: ClientEvent) -> None: """Event callback registered to the sendspin server.""" diff --git a/music_assistant/providers/universal_player/player.py b/music_assistant/providers/universal_player/player.py index 1e131ef1..9c825dee 100644 --- a/music_assistant/providers/universal_player/player.py +++ b/music_assistant/providers/universal_player/player.py @@ -61,6 +61,28 @@ class UniversalPlayer(Player): # it delegates to protocol players self._attr_supported_features = set() + @property + def hidden_by_default(self) -> bool: + """Return if the player should be hidden in the UI by default.""" + if len(self.linked_output_protocols) == 0: + # If we have no linked protocols, hide by default + return True + if self.device_info.model.lower() == "web browser": # noqa: SIM103 + # hide web players by default + return True + return False + + @property + def expose_to_ha_by_default(self) -> bool: + """Return if the player should be exposed to Home Assistant by default.""" + if len(self.linked_output_protocols) == 0: + # If we have no linked protocols, hide by default + return False + if self.device_info.model.lower() == "web browser": # noqa: SIM103 + # hide web players by default + return False + return True + def _get_control_target( self, required_feature: PlayerFeature, require_active: bool = False ) -> Player | None: -- 2.34.1