Open override80 opened 1 day ago
I am not familiar with the details of Music Assistant, so not sure how to direct you there.
As for SoundTouch device DLNA support, I believe all you have to do is add a "Music Library on Computer" music service entry via the SoundTouch App, as well as have the "SoundTouch Music Server" running in the background (on Windows OS anyway):
This will appear as a source in the SoundTouchPlus device list:
The SoundTouch Music Server then exposes the defined music service as a DLNA endpoint which should be recognized (I would think anyway) by Music Assistant.
Also note that the SoundTouch App music service "Music Library on NAS" is different than the "Music Library on Computer" music service. I'm not sure if the "Music Service on NAS" uses DLNA for streaming or not; I think it does, but the DLNA server would be the NAS device instead of the "SoundTouch Music Server". I'm fuzzy on that though, as it's been awhile since I played with DLNA support on my SoundTouch devices.
I believe the Upnp
source is reserved for Bose internal use; I have never tried to select that source directly. I have always used the play_contentitem
SoundTouchPlus service to play content from the "SoundTouch Music Server" DLNA server (notice the source: LOCAL_MUSIC
setting):
# play dlna local music content.
service: soundtouchplus.play_contentitem
data:
entity_id: media_player.soundtouch_10
name: Welcome to the New
source: LOCAL_MUSIC
source_account: 3f205110-4a57-4e91-810a-ad949d25abb2
item_type: album
location: 'album:983'
container_art: http://192.168.1.1:8085/v1/albums/983/image?_=1&w=62
is_presetable: true
I have always used the play_contentitem
SoundTouchPlus service to play content from the "NAS" DLNA server (notice the source: STORED_MUSIC
setting):
# play music library on NAS content.
service: soundtouchplus.play_contentitem
data:
entity_id: media_player.soundtouch_10
name: Welcome to the New
source: STORED_MUSIC
source_account: 'd09708a1-5953-44bc-a413-123456789012/0'
location: '7_11412345'
container_art: http://192.168.1.1:10243/WMPNSSv4/2050238549/0_N18xMTRlOGRlOS00MDE5.jpg?albumArt=true
is_presetable: true
As for Music Assistant being able to play on the SoundTouch devices, I would think it would not be possible unless MA implements some sort of interface to the SoundTouch Web API. Or maybe you have to configure the MA to call the soundtouchplus.play_contentitem
service? Not sure how MA works for that.
Hope it helps!
Hi @thlucas1 , thanks for the precious feedback. I gave it a try adding the "My music library" service to the SoundTouch app, unfortunately
The weirdest thing is that in one ST-10 the DLNA is somehow working (despire reporting the device as paused instead of off):
The other ST-10s are just in "unknown" state:
It makes no sense. I'm guessing that it has something to do with some bug in the DLNA Digital Media Renderer integration in home assistant.
@override80
Keep in mind that the media_player.soundtouch_10_bedroom
and soundtouch_10_bedroom_dlna
are two separate media players, with the soundtouch_10_bedroom_dlna
player being the one that controls the device if controlled through DLNA Digital Media Renderer integration. I can only speak for what the media_player.soundtouch_10_bedroom
is doing, as that's the SoundTouchPlus integration media player.
Do you remember if you enabled the SoundTouchPlus integration Websocket Port option on the media_player.soundtouch_10_bedroom
device when you set it up? If enabled, this should cause the SoundTouchPlus media player to receive updates of when statuses change on the device from external sources. To check if it's currently enabled, display the device state and look for the soundtouchplus_websockets_enabled: xxxx
value; it will be true
if enabled, false
if disabled.
The Websocket Port functionality causes the SoundTouchPlus media player to update as events happen on the device, from whatever is controlling it (e.g. a button press on the device, pressing pause on the HA media player UI, issuing an HA service call to resume playback, starting a track via a DLNA client, etc).
For example, here is what my Bose ST-10 device status looks like (going from off
state) after starting a track via the Bose SoundTouch App for the THLUCASI9 Music
source (e.g. DLNA / "Music Library on Computer" music service):
I would agree with your statement that the DLNA Digital Media Renderer integration is not handling something correctly.
Hope that helps.
I just readded all soundtouch devices enabling websocket as suggested.
It's much better!
Now i can play a song from the soundtouch app from spotify, then when music assistant steps in, it works! this is valid for the ST-10s. On the ST-20 i get the following error when trying to play a song from Music Asistant:
2024-11-27 18:35:59.741 ERROR (SyncWorker_3) [bosesoundtouchapi.soundtouchclient] SoundTouchError: "BST1002E - 'SoundTouch 20 LivingRoom': SoundTouch Web-services API returned an error status: 'unsupported device'", code="403", name="HTTP_STATUS_FORBIDDEN", severity="Unknown"
2024-11-27 18:35:59.742 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140306373793040] Unexpected exception
Traceback (most recent call last):
File "/config/custom_components/soundtouchplus/media_player.py", line 916, in play_media
self._client.PlayUrl(media_id, artist=announceValue, album=announceValue, getMetaDataFromUrlFile=True, volumeLevel=0)
File "/usr/local/lib/python3.12/site-packages/bosesoundtouchapi/soundtouchclient.py", line 3048, in PlayUrl
self.MakeRequest('POST', message)
File "/usr/local/lib/python3.12/site-packages/bosesoundtouchapi/soundtouchclient.py", line 2445, in MakeRequest
self._CheckResponseForErrors(msg.Response)
File "/usr/local/lib/python3.12/site-packages/bosesoundtouchapi/soundtouchclient.py", line 307, in _CheckResponseForErrors
raise SoundTouchError(errMessage, errName, errSeverity, errValue, _logsi)
bosesoundtouchapi.soundtoucherror.SoundTouchError: SoundTouchError: "BST1002E - 'SoundTouch 20 LivingRoom': SoundTouch Web-services API returned an error status: 'unsupported device'", code="403", name="HTTP_STATUS_FORBIDDEN", severity="Unknown"
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/config/custom_components/soundtouchplus/media_player.py", line 846, in async_play_media
await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/soundtouchplus/media_player.py", line 949, in play_media
raise HomeAssistantError(str(ex)) from ex
homeassistant.exceptions.HomeAssistantError: SoundTouchError: "BST1002E - 'SoundTouch 20 LivingRoom': SoundTouch Web-services API returned an error status: 'unsupported device'", code="403", name="HTTP_STATUS_FORBIDDEN", severity="Unknown"
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/soundtouchplus/media_player.py", line 854, in async_play_media
raise HomeAssistantError(str(ex)) from ex
homeassistant.exceptions.HomeAssistantError: SoundTouchError: "BST1002E - 'SoundTouch 20 LivingRoom': SoundTouch Web-services API returned an error status: 'unsupported device'", code="403", name="HTTP_STATUS_FORBIDDEN", severity="Unknown"
Seems similar to the issues connected to TTS notifications on ST-20, isn't it? Probably because Music Assistant switches the player to the following source:
I forgot that the ST-20 does not support websockets. See the Bose SoundTouch ST-20 limitations wiki for more details.
The ST-20 supports TTS notifications, per the TTS notify service notes.
System Health details
System Information
Home Assistant Community Store
GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok HACS Data | ok GitHub API Calls Remaining | 5000 Installed Version | 2.0.1 Stage | running Available Repositories | 1488 Downloaded Repositories | 113AccuWeather
can_reach_server | ok -- | -- remaining_requests | 11Home Assistant Supervisor
host_os | Debian GNU/Linux 12 (bookworm) -- | -- update_channel | stable supervisor_version | supervisor-2024.11.4 agent_version | 1.6.0 docker_version | 27.2.1 disk_total | 453.2 GB disk_used | 135.6 GB healthy | true supported | true host_connectivity | true supervisor_connectivity | true ntp_synchronized | true virtualization | supervisor_api | ok version_api | ok installed_addons | AppDaemon (0.16.7), Home Assistant Google Drive Backup (0.112.1), Let's Encrypt (5.2.5), MariaDB (2.7.1), NGINX Home Assistant SSL proxy (3.11.1), TasmoAdmin (0.31.0), Rhasspy Assistant (2.5.11), Hikvision Doorbell (3.0.19), ESPHome Device Compiler (2024.11.1), Prowlarr NAS (nightly-1.27.0.4846-ls104), FlareSolverr (3.3.21), Radarr (5.15.1.9463), Sonarr (4.0.10.2656), Network UPS Tools (0.13.2), Jellyseerr (2.1.0), Exadel CompreFace (1.1.0), Portainer (2.24.0), Piper (1.5.2), Whisper (2.2.0), openWakeWord (1.10.0), Cloudflared (5.2.2), Jellyfin NAS (10.10.3), Music Assistant Server (2.3.3), qBittorrent (5.0.2), Frigate (Full Access) (0.14.1), Double Take (1.13.11.8), Rclone Backup (3.3.2), OpenVPN Client (0.0.2), UniFi Network Application (3.5.0), EMQX (0.7.2), phpMyAdmin (0.10.0)Dashboards
dashboards | 8 -- | -- resources | 62 views | 36 mode | storageRecorder
oldest_recorder_run | November 18, 2024 at 7:16 AM -- | -- current_recorder_run | November 26, 2024 at 4:13 PM estimated_db_size | 5379.84 MiB database_engine | mysql database_version | 10.11.6Solcast PV Forecast
can_reach_server | ok -- | --Bose SoundTouch Plus
integration_version | v1.0.72 -- | -- devices_configured | 4: SoundTouch 20 LivingRoom (SoundTouch 20), SoundTouch 10 Bedroom (SoundTouch 10), SoundTouch 10 Giulio (SoundTouch 10), SoundTouch 10 Gym (SoundTouch 10)Spotify
api_endpoint_reachable | ok -- | --SpotifyPlus
integration_version | v1.0.66 -- | -- clients_configured | 1: override (premium) api_endpoint_reachable | okChecklist
Describe the issue
Hi @thlucas1 , I'm wondering if you ever tried to use soundtouchplus devices with Music Assistant.
Until a few weeks ago, my soundtouch speakers were working correclty as DLNA Media Renderer and i used this DLNA devices to play music from Music Assistant.
Well, adding my soundtouchplus devices (ST10 and ST20) to Music Assistant directly as Home Assistant players (because for some reason DLNA Media renderer are "Unavailable") will not work until i change the source to "Notification" in the SoundTouchPlus home assistant media players. I have to manually do this every time on speakers that i want to use from Music Assistant. Problems are somehow expected (https://music-assistant.io/player-support/ha/).
If i switch the source to Upnp (which should be the one used by DLNA, afaiu) the device becomes unavailable and I have to go with the Bose SoundTouch App to play a song from spotify or wherever to have the device back in a proper state in Home Assistant.
I have opened an issue about the DLNA problem (https://github.com/home-assistant/core/issues/131537), It should not be related to SoundTouchPlus though.
Do you have any experience here? What's the best way to use Music Assistant with SoundTouchPlus devices (via Home Assistant Player Provider or via DLNA Player Provider? Consider that I also use SoundTouch devices to TTS notifications)?
Thanks!
PS I also have no idea why it goes to unknown when I play via Music Assistant as an Home Assistant Player:
On the ST-20 i get clear errors in logs:
but also on the ST-10 when trying to play via DLNA:
Reproduction steps
Debug logs
Diagnostics dump
No response