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.21k stars 44 forks source link

Error: Resume queue requested but queue is empty #2455

Closed smartmatic closed 2 weeks ago

smartmatic commented 2 weeks ago

What version of Music Assistant has the issue?

2.0.4

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

2024.5.1

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

The problem

I have a couple of automations for a view announcements. I have replaced all HA players with MA players. MA is throwing errors saying that the queue is empty after sending a TTS announcement. I have noticed that the status of players are not updated e.g. a player shows its playing but there is actually no stream active.

How to reproduce

  1. Create automation and add more than two MA players which send a TTS in parallel
  2. Try to resume also when there was nothing streamed before the announcement was send without errors

Music Providers

RadioBrowser, Spotify

Player Providers

Airplay

Full log output

ma_core_log.txt

Additional information

HA Error

Logger: homeassistant.components.automation.benachrichtigung_geburtstag Quelle: helpers/script.py:526 Integration: Automatisierung (Dokumentation, Probleme) Erstmals aufgetreten: 08:00:13 (4 Vorkommnisse) Zuletzt protokolliert: 08:00:14

Benachrichtigung: Termine: Parallel action at step 2: parallel 1: Error executing script. Unexpected error for call_service at pos 1: Resume queue requested but queue ape02b968f8b79 is empty Benachrichtigung: Termine: Parallel action at step 2: parallel 3: Error executing script. Unexpected error for call_service at pos 1: Resume queue requested but queue apacbcb5dccc7f is empty Benachrichtigung: Termine: Parallel action at step 2: parallel 2: Error executing script. Unexpected error for call_service at pos 1: Resume queue requested but queue apf434f04b99c2 is empty Benachrichtigung: Termine: Error executing script. Unexpected error for parallel at pos 2: Resume queue requested but queue ape02b968f8b79 is empty Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 763, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action return await long_task ^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2741, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2784, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/tts/legacy.py", line 159, in async_say_handle await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 2741, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2784, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 977, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1049, in _handle_entity_call result = await task ^^^^^^^^^^ File "/config/custom_components/mass/media_player.py", line 376, in async_play_media await self._async_play_announcement( File "/config/custom_components/mass/media_player.py", line 465, in _async_play_announcement await self.mass.players.play_announcement( File "/usr/local/lib/python3.12/site-packages/music_assistant/client/players.py", line 143, in play_announcement await self.client.send_command( File "/usr/local/lib/python3.12/site-packages/music_assistant/client/client.py", line 254, in send_command return await future ^^^^^^^^^^^^ music_assistant.common.models.errors.QueueEmpty: Resume queue requested but queue ape02b968f8b79 is empty

What version of Home Assistant Core are your running

2024.6.2

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

Alternative

marcelveldt commented 2 weeks ago

1) Can you show the automation you are using ? 2) Are you sure that you are using the Airplay provider in MA ? Its optimized for high quality streaming, the apple tv integration in HA is not and will malfunction many times (as you can also see in your log). 3) A queue empty error is thrown when you send a play command to a player without any items in the queue so that is by design.

smartmatic commented 2 weeks ago
  1. Can you show the automation you are using ?

    alias: "Benachrichtigung: Geburtstag"
    description: ""
    trigger:
    - platform: calendar
    event: start
    offset: "-0:30:0"
    entity_id: calendar.familie
    alias: Wenn Kalender Status Familie An
    - platform: state
    entity_id:
    - calendar.familie
    for:
    hours: 7
    minutes: 30
    seconds: 0
    to: "true"
    attribute: all_day
    condition: []
    action:
    - service: notify.persistent_notification
    data:
    message: Termin {{state_attr("calendar.familie", "message") }}
    - parallel:
    - service: tts.cloud_say
    data:
    cache: false
    entity_id: media_player.homepod_anita_ma
    message: Termin {{state_attr("calendar.familie", "message") }}
    - service: tts.cloud_say
    data:
    cache: false
    entity_id: media_player.homepod_kueche_ma
    message: Termin {{state_attr("calendar.familie", "message") }}
    - service: tts.cloud_say
    data:
    cache: false
    entity_id: media_player.homepod_esszimmer_ma
    message: Termin {{state_attr("calendar.familie", "message") }}
    - if:
    - condition: state
    entity_id: light.switchbot_office
    state: "off"
    then:
    - service: tts.cloud_say
    data:
    cache: false
    entity_id: media_player.homepod_buero_ma
    message: Termin {{state_attr("calendar.familie", "message") }}
    mode: single
  2. Are you sure that you are using the Airplay provider in MA ? Its optimized for high quality streaming, the apple tv integration in HA is not and will malfunction many times (as you can also see in your log).

I think yes. I replaced all my HA media players in my automations with MA media players. Is there anything else i need to configure? Is replacing HA media players with MA media players what you meant with if i am using Airplay provider?

  1. A queue empty error is thrown when you send a play command to a player without any items in the queue so that is by design.

ok

smartmatic commented 2 weeks ago

Today i am asked configure MA Integration again and now i have three entries. The first entry is the new one, the second one the already configured entities. The third one has no entities.

Bildschirmfoto 2024-06-14 um 07 26 40

Ist that behaviour correct?

OzGav commented 2 weeks ago

Ok this is unrelated to the original report so in future try not to confuse things by doing this. I suggest removing them all and starting again.

smartmatic commented 2 weeks ago

Ok this is unrelated to the original report so in future try not to confuse things by doing this. I suggest removing them all and starting again.

Sorry that is not my intention but i thought it might be related to my initial report. I removed the MA Integration and re-added it. Then i restarted HA and two new Integrations are popping up to be configured.

Bildschirmfoto 2024-06-14 um 08 22 15

OzGav commented 2 weeks ago

It looks to me like you have two versions of the integration installed as the word BETA should not be there anymore. I would remove from HA all versions, remove from HACS, restart HA and then install 2024.6.0 (or later) from HACS

If you still have multiple versions then check if you have multiple versions of the server running on your network

smartmatic commented 2 weeks ago

It looks to me like you have two versions of the integration installed as the word BETA should not be there anymore. I would remove from HA all versions, remove from HACS, restart HA and then install 2024.6.0 (or later) from HACS

If you still have multiple versions then check if you have multiple versions of the server running on your network

I've cleaned up the system and re-installed and configured everything again although Beta was no longer installed in parallel. I will keep that issue updated if i am facing the initial error again. Sorry for that side topic before.

smartmatic commented 2 weeks ago

Now i get this error:

Logger: homeassistant.components.media_player
Quelle: helpers/entity_platform.py:766
Integration: Mediaplayer (Dokumentation, Probleme)
Erstmals aufgetreten: 09:37:14 (5 Vorkommnisse)
Zuletzt protokolliert: 09:37:14

Platform mass does not generate unique IDs. ID mass_media_player.hp_buero already exists - ignoring media_player.homepod_buero
Platform mass does not generate unique IDs. ID mass_media_player.hp_anita already exists - ignoring media_player.homepod_anita
Platform mass does not generate unique IDs. ID mass_media_player.homepod already exists - ignoring media_player.homepod_ha_gruppe
Platform mass does not generate unique IDs. ID mass_media_player.hp_esszimmer already exists - ignoring media_player.homepod_esszimmer
Platform mass does not generate unique IDs. ID mass_media_player.hp_kueche already exists - ignoring media_player.homepod_kuche

media_player.hp_buero = Apple TV Integration media_player.homepod_buero = MASS Integration

Is it not possible to have the AppleTV integration active in parallel to MA?

marcelveldt commented 2 weeks ago

You have multiple instances running of MA - after you cleaned up the issues above, did you restart HA ?

You can have ATV integration and MA installed side by side just fine (although I wouldn't really recommend the atv integration for playback to homepods)

OzGav commented 2 weeks ago

@smartmatic There have been a bunch of updates lately. Can you ensure you have the latest integration 2024.6.2 or later and the latest server version and provide an update on where we are at with this report.

smartmatic commented 2 weeks ago

I have tested one script manually and the everything went well. The tested script is a similar sequence as the automation i have used which has caused the reported error but without any issues.

Bildschirmfoto 2024-06-15 um 19 24 44

S

OzGav commented 2 weeks ago

Ok sounds like this is fixed