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
71k stars 29.65k forks source link

media_player.play_media Still Running Prevents Automation from completing #100131

Closed pug306d closed 1 month ago

pug306d commented 11 months ago

The problem

I have an automation to play the radio through my homepod in the morning:

data: media_content_id: http://edge-bauerall-01-gos2.sharp-stream.com/freeshropshire.mp3 media_content_type: music enqueue: add service: media_player.play_media target: entity_id: media_player.bedroom_homepod

This is one entry in the automation about half way through and the automation also calls other services to turn lights on etc. The automation works until it gets to this step and then gets stuck, the trace shows this step is "Still Running" and the automation does not proceed past this step automatically.

The homepod does play the radio fine it just never stops as its a radio station.

The automation will continue to the other steps if I run media_player.media_stop against the homepod which was playing the radio.

The HA logs report these errros when I run the automation:

2023-09-11 14:55:24.097 WARNING (MainThread) [pyatv.support.http] Got response without having a request: HttpResponse(protocol='RTSP', version='1.0', code=200, message='OK', headers={'Date': 'Mon, 11 Sep 2023 13:55:24 GMT', 'Content-Length': '0', 'Server': 'AirTunes/695.5.1', 'CSeq': '21'}, body='') 2023-09-11 14:55:30.711 WARNING (MainThread) [homeassistant.util.async_] Detected blocking call to sleep inside the event loop. This is causing stability issues. Please report issue for apple_tv doing blocking calls at homeassistant/components/apple_tv/media_player.py, line 300: await self.atv.stream.stream_file(mediaid) 2023-09-11 14:55:30.813 WARNING (MainThread) [homeassistant.util.async] Detected blocking call to sleep inside the event loop. This is causing stability issues. Please report issue for apple_tv doing blocking calls at homeassistant/components/apple_tv/media_player.py, line 300: await self.atv.stream.stream_file(mediaid) 2023-09-11 14:55:30.914 WARNING (MainThread) [homeassistant.util.async] Detected blocking call to sleep inside the event loop. This is causing stability issues. Please report issue for apple_tv doing blocking calls at homeassistant/components/apple_tv/media_player.py, line 300: await self.atv.stream.stream_file(mediaid) 2023-09-11 14:55:31.015 WARNING (MainThread) [homeassistant.util.async] Detected blocking call to sleep inside the event loop. This is causing stability issues. Please report issue for apple_tv doing blocking calls at homeassistant/components/apple_tv/media_player.py, line 300: await self.atv.stream.stream_file(mediaid) 2023-09-11 14:55:34.239 WARNING (MainThread) [homeassistant.util.async] Detected blocking call to sleep inside the event loop. This is causing stability issues. Please report issue for apple_tv doing blocking calls at homeassistant/components/apple_tv/media_player.py, line 300: await self.atv.stream.stream_file(mediaid) 2023-09-11 14:55:34.340 WARNING (MainThread) [homeassistant.util.async] Detected blocking call to sleep inside the event loop. This is causing stability issues. Please report issue for apple_tv doing blocking calls at homeassistant/components/apple_tv/media_player.py, line 300: await self.atv.stream.stream_file(mediaid) 2023-09-11 14:55:34.442 WARNING (MainThread) [homeassistant.util.async] Detected blocking call to sleep inside the event loop. This is causing stability issues. Please report issue for apple_tv doing blocking calls at homeassistant/components/apple_tv/media_player.py, line 300: await self.atv.stream.stream_file(media_id)

What version of Home Assistant Core has the issue?

core-2023.9.1

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

apple_tv

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

data:
  media_content_id: http://edge-bauerall-01-gos2.sharp-stream.com/freeshropshire.mp3
  media_content_type: music
  enqueue: add
service: media_player.play_media
target:
  entity_id: media_player.bedroom_homepod

Anything in the logs that might be useful for us?

2023-09-11 14:55:24.097 WARNING (MainThread) [pyatv.support.http] Got response without having a request: HttpResponse(protocol='RTSP', version='1.0', code=200, message='OK', headers={'Date': 'Mon, 11 Sep 2023 13:55:24 GMT', 'Content-Length': '0', 'Server': 'AirTunes/695.5.1', 'CSeq': '21'}, body='')
2023-09-11 14:55:30.711 WARNING (MainThread) [homeassistant.util.async_] Detected blocking call to sleep inside the event loop. This is causing stability issues. Please report issue for apple_tv doing blocking calls at homeassistant/components/apple_tv/media_player.py, line 300: await self.atv.stream.stream_file(media_id)
2023-09-11 14:55:30.813 WARNING (MainThread) [homeassistant.util.async_] Detected blocking call to sleep inside the event loop. This is causing stability issues. Please report issue for apple_tv doing blocking calls at homeassistant/components/apple_tv/media_player.py, line 300: await self.atv.stream.stream_file(media_id)
2023-09-11 14:55:30.914 WARNING (MainThread) [homeassistant.util.async_] Detected blocking call to sleep inside the event loop. This is causing stability issues. Please report issue for apple_tv doing blocking calls at homeassistant/components/apple_tv/media_player.py, line 300: await self.atv.stream.stream_file(media_id)
2023-09-11 14:55:31.015 WARNING (MainThread) [homeassistant.util.async_] Detected blocking call to sleep inside the event loop. This is causing stability issues. Please report issue for apple_tv doing blocking calls at homeassistant/components/apple_tv/media_player.py, line 300: await self.atv.stream.stream_file(media_id)
2023-09-11 14:55:34.239 WARNING (MainThread) [homeassistant.util.async_] Detected blocking call to sleep inside the event loop. This is causing stability issues. Please report issue for apple_tv doing blocking calls at homeassistant/components/apple_tv/media_player.py, line 300: await self.atv.stream.stream_file(media_id)
2023-09-11 14:55:34.340 WARNING (MainThread) [homeassistant.util.async_] Detected blocking call to sleep inside the event loop. This is causing stability issues. Please report issue for apple_tv doing blocking calls at homeassistant/components/apple_tv/media_player.py, line 300: await self.atv.stream.stream_file(media_id)
2023-09-11 14:55:34.442 WARNING (MainThread) [homeassistant.util.async_] Detected blocking call to sleep inside the event loop. This is causing stability issues. Please report issue for apple_tv doing blocking calls at homeassistant/components/apple_tv/media_player.py, line 300: await self.atv.stream.stream_file(media_id)

Additional information

No response

home-assistant[bot] commented 11 months ago

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

Code owner commands Code owners of `apple_tv` 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 apple_tv` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


apple_tv documentation apple_tv source (message by IssueLinks)

issue-triage-workflows[bot] commented 8 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

pug306d commented 8 months ago

Still an issue in 12.1

issue-triage-workflows[bot] commented 5 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

pug306d commented 5 months ago

👍

michaeldwan commented 4 months ago

I'm seeing the same issue. Running media_player.play_media to a Sonos speaker yields control back to the automation after starting. Doing the same to a HomePod mini blocks until the media file ends or is stopped manually.

issue-triage-workflows[bot] commented 1 month ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.