hass-music-assistant: [BUG] Error - Chromecast 192.168.1.197:32071 is connecting

What version of Music Assistant has the issue?

2.0.0.b118

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

2024.3.4

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

  • Yes

The problem

Occasionally when starting play on Google Cast speakers this error occurs in the HA log and MASS play does not start. Seems to happen more with speaker groups than individual speakers.

Moreso than the actual error (I understand cast speakers can be kooky), the issue is that I most often I call mass.play_media from a hass script and when the mass.play_media call fails with this error, the continue_on_error parameter in the service call is not respected and the rest of the script does not run.

Calling the same script again with the same parameters no other changes is usually successful with no errors.

    - service: mass.play_media
      target:
        entity_id: media_player.inside_speakers
      data:
        media_id: "All Out 70s"
        media_type: playlist
        enqueue: replace
      continue_on_error: true #MASS script does not continue if mass fails

This is the error from the HA log.

2024-03-22 13:18:22.165 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [281470730760384] Chromecast 192.168.1.197:32071 is connecting...
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2319, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2356, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 611, in _service_handler
    response = await self._async_start_run(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 569, in _async_start_run
    script_result = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 600, in _async_run
    return await self.script.async_run(script_vars, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1600, in async_run
    return await asyncio.shield(run.async_run())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1140, in async_run
    await super().async_run()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 435, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 487, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 535, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 723, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2319, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2356, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 905, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/mass/media_player.py", line 517, in _async_play_media_advanced
    await self.mass.players.play_media(
  File "/usr/local/lib/python3.12/site-packages/music_assistant/client/players.py", line 293, in play_media
    await self.client.send_command(
  File "/usr/local/lib/python3.12/site-packages/music_assistant/client/client.py", line 178, in send_command
    return await future
           ^^^^^^^^^^^^
music_assistant.common.models.errors.MusicAssistantError: Chromecast 192.168.1.197:32071 is connecting...

How to reproduce

Happens intermittently when calling mass.play_media on Google Cast speakers from a script.

Music Providers

Youtube, Spotify, Tune-In

Player Providers

Chromecast

Full log output

ha-log.txt

Additional information

This has been an issue for a while, it is not something that has popped up with any recent updates.

What version of Home Assistant Core are your running

2024.3.2

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

ODROID

About this issue

  • Original URL
  • State: open
  • Created 3 months ago
  • Comments: 21 (12 by maintainers)

Most upvoted comments

HA Blue. Wasn’t a complaint or unexpected, just an observation. I’ve never seen all 3 at 100% before. I’m also running Frigate on a couple of cams as well so I’m pushing my Blue pretty hard. Looking to upgrade to something with a little more juice in the near future.