home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.18k stars 30.21k forks source link

Timeout failure of media_player.media_stop service call. #114259

Open Kagey-cmd opened 6 months ago

Kagey-cmd commented 6 months ago

The problem

I am trying to issue a "media_player.media_stop" service call to a Google Home Mini playing music from Spotify. When the service call occurs, the playback stops, but I invariably get:

"Failed to call service media_player.media_stop. CastMediaPlayerEntity.media_stop Failed: Execution of stop timed out after 10.0 s."

Upon checking the logs:

Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/connection.py:300 integration: Home Assistant WebSocket API (documentation, issues) First occurred: 2:06:07 PM (8 occurrences) Last logged: 2:19:59 PM

What version of Home Assistant Core has the issue?

core-2024.3.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Media Player and/or Websocket API

Link to integration documentation on our website

https://www.home-assistant.io/integrations/websocket_api/

Diagnostics information

No response

Example YAML snippet

service: media_player.media_stop
target:
  entity_id:
    - media_player.google_home_mini
data: {}

Anything in the logs that might be useful for us?

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/connection.py:300
integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 2:06:07 PM (8 occurrences)
Last logged: 2:19:59 PM

Additional information

This is what I get in the service dev tool:

Failed to call service media_player.media_stop. CastMediaPlayerEntity.media_stop Failed: Execution of stop timed out after 10.0 s.

home-assistant[bot] commented 6 months ago

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (websocket_api) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `websocket_api` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign websocket_api` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


websocket_api documentation websocket_api source (message by IssueLinks)

home-assistant[bot] commented 6 months ago

Hey there @emontnemery, mind taking a look at this issue as it has been labeled with an integration (cast) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `cast` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign cast` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


cast documentation cast source (message by IssueLinks)

alexbaucom17 commented 6 months ago

I am also seeing this issue. It appears to be intermittent for me as sometimes my cast scripts run correctly and sometimes they do not. OP didn't provide their last working version but this was not an issue for me on 2024.2.1. I just updated to 2024.3.3 a couple days ago and have been running into this issue ever since.

Kagey-cmd commented 6 months ago

I am also seeing this issue. It appears to be intermittent for me as sometimes my cast scripts run correctly and sometimes they do not. OP didn't provide their last working version but this was not an issue for me on 2024.2.1. I just updated to 2024.3.3 a couple days ago and have been running into this issue ever since.

It's not intermittent for me: very consistent. I'm on 2024.3.3, but I'm not sure when this issue began, or even if it's always been happening. I just noticed it while troubleshooting TheFes/Google-Home-Resume#8.

Kagey-cmd commented 6 months ago

Just got this same timeout error on a first gen Google Home/Nest Hub.

Kagey-cmd commented 6 months ago

Perhaps related to home-assistant/core#113918

birdwing commented 5 months ago

just had this same timeout error on a second gen Google Home/Nest Hub.

thegreekgeek commented 5 months ago

I am also getting this error when running the google home resume script.

Jojotjo56 commented 5 months ago

I have the same problem when playing spotify and I want to stop a mediaplayer.

Fout: CastMediaPlayerEntity.media_stop Failed: Execution of stop timed out after 10.0 s. Resultaat: params: domain: media_player service: media_stop service_data: {} target: entity_id:

smarthomefamilyverrips commented 5 months ago

Same when try to turn of Google Hub.

Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/commands.py:239 integration: Home Assistant WebSocket API (documentation, issues) First occurred: 10:18:19 (8 occurrences) Last logged: 10:19:35

[281472196396480] CastMediaPlayerEntity.turn_off Failed: Failed to execute quit app. [281472196396480] CastMediaPlayerEntity.turn_off Failed: Execution of quit app timed out after 10.0 s. Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 106, in wrapper return_value = func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 548, in turn_off self._get_chromecast().quit_app() File "/usr/local/lib/python3.12/site-packages/pychromecast/init.py", line 463, in quit_app response_handler.wait_response() File "/usr/local/lib/python3.12/site-packages/pychromecast/response_handler.py", line 57, in wait_response raise RequestFailed(self._request) pychromecast.error.RequestFailed: Failed to execute quit app.

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 239, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1043, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/media_player/init.py", line 798, in async_turn_off await self.hass.async_add_executor_job(self.turn_off) File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 108, in wrapper raise HomeAssistantError( homeassistant.exceptions.HomeAssistantError: CastMediaPlayerEntity.turn_off Failed: Failed to execute quit app.

WillT93 commented 4 months ago

Same issue here calling Media Player Stop or Pause on a 2nd (maybe 3rd??) gen Chromecast. Also occurs with the same service calls on a Google Nest Hub 2nd gen. Both Plex and Netflix. Very odd. Only started recently.

idogrf commented 1 month ago

Same for me on google nest mini 2. The playback stops immediately when calling the service, but I get the timeout error regardless