music-assistant / hass-music-assistant

Turn your Home Assistant instance into a jukebox, hassle free streaming of your favorite media to Home Assistant media players.
Apache License 2.0
1.2k stars 44 forks source link

mass.play_announcement plays the file but return an error and stop any HomeAssistant scripts sequence #2535

Open I-G-1-1 opened 4 days ago

I-G-1-1 commented 4 days ago

What version of Music Assistant has the issue?

2.1.0b8

What version of the Home Assistant Integration have you got installed?

2024.6.4

Have you tried everything in the Troubleshooting FAQ and reviewed the Open and Closed Issues and Discussions to resolve this yourself?

The problem

when using MusicAssistant service "mass.play_announcement" the file is correctly played by the media_player entity, but HomeAssistant give error and if the service call is inside a script it stop the script sequence.

01

same problem with the service "tts.google_say" and a MusicAssistant player as media_player entity

How to reproduce

as said below

Music Providers

www folder on HomeAssistant installation

Player Providers

Chromecast

Full log output

mass.play_announcement error:

2024-06-24 15:28:11.099 INFO (MainThread) [music_assistant.players] Playback announcement to player Camera (with pre-announce: True): http://192.168.xxx.xxx:8123/local/01.mp3
2024-06-24 15:28:14.379 ERROR (MainThread) [music_assistant.webserver] Error handling message: players/cmd/play_announcement: file not found: http:/192.168.xxx.xxx:8123/local/01.mp3

tts.google_say error:

2024-06-24 16:43:45.794 INFO (MainThread) [music_assistant.players] Playback announcement to player Camera (with pre-announce: True): http://192.168.xxx.xxx:8123/api/tts_proxy/1e4e888ac66f8dd41e00c5a7ac36a32a9950d271_en_-_google_translate.mp3
2024-06-24 16:43:46.920 ERROR (MainThread) [music_assistant.webserver] Error handling message: players/cmd/play_announcement: file not found: http:/192.168.xxx.xxx:8123/api/tts_proxy/1e4e888ac66f8dd41e00c5a7ac36a32a9950d271_en_-_google_translate.mp3

Additional information

HomeAssistant error:

ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Error for call_service at pos 1: MusicAssistantError: file not found: http:/192.168.xxx.xxx:8123/local/01.mp3

What version of Home Assistant Core are your running

2024.6.4

What type of installation are you running?

Home Assistant Container

On what type of hardware are you running?

Raspberry Pi

I-G-1-1 commented 4 days ago

for now solved adding in the HomeAssistant scripts:

continue_on_error: true

for "mass.play_announcement" and "tts.google_say" services

OzGav commented 4 days ago

The error seems clear as it indicates the file is not found but you say it actually plays correctly? Please show the whole script. If you look closely at the error you will see a missing / in the url. It shows http:/ not http://

I-G-1-1 commented 4 days ago

It's not important the whole script as HomeAssistant and MusicAssistant give the error simply using the "developer tools/services" in HomeAssistant (the screenshot I took is from the developer tools). As consequence of the error any script terminate and doesn't go further. As workaround using "continue_on_error: true" let HomeAssistant ignore the error and continue to run the script.

The error seems clear as it indicates the file is not found but you say it actually plays correctly?

Yes the file plays correctly on the media_player. So it seems like MusicAssistant does its job correctly but incorrectly returns an error pretending the file just played doesn't exist.

If you look closely at the error you will see a missing / in the url. It shows http:/ not http://

I saw that. However you can see the url I set in the developer tools has correctly "http://", only the lines that reports the error in the web-ui and in the log have "http:/". As mentioned before the file plays well on the media_player so I'm more inclined to believe that the "http:/" is a rendering issue made by MusicAssistant when try to return the error.

OzGav commented 8 hours ago

I'm not sure whether the missing / is just a display issue. Someone else reported a similar problem adding a radio URL. Its being looked at.

mathfreakmichael commented 6 hours ago

I'm having the exact same issue, down to the missing forward slash on http for the error. The only addition I have is that one of my squeezelites won't even play the file. Two of my three using lms lite, play even though it errors. The two that play are esp32 based and an amd manjaro 64 bit. The one not playing the file is a rpi 4b. In addition, chromecast devices using the mass media player also give the error but still play the file for announcements as well.

Just hoped to share in case it bears any fruit.