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
71.93k stars 30.15k forks source link

Cast throws "resolvable URL" while it is #45349

Closed andriej closed 3 years ago

andriej commented 3 years ago

The problem

While using cast integration with Google Cloud, sometimes I encounter and error while integrations works. My URL have proper SSL cert (both inside and outside) and all five tries of casting TTS to Google Mini worked well. Error below.

Both errors count, but the one I wanted to report more is: Failed to cast media https://www.home-assistant.io/images/cast/splash.png. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address - it appeares randomly in log, while I don't even try to cast splash, neither I can - because it's speaker device.

Environment

Problem-relevant configuration.yaml

n/a

Traceback/Error logs

Logger: homeassistant.components.cast.media_player
Source: components/cast/media_player.py:348
Integration: Google Cast (documentation, issues)
First occurred: 9:25:02 (2 occurrences)
Last logged: 9:25:30

Failed to cast media https://www.home-assistant.io/images/cast/splash.png. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address
Failed to cast media https://[redacted].org/api/tts_proxy/0[redacted]0_en-us_8[redacted]e_google_cloud.mp3 from internal_url (https://[redacted].org). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

Additional information

probot-home-assistant[bot] commented 3 years ago

cast documentation cast source (message by IssueLinks)

samhed commented 3 years ago

I'm getting the same issue, started happening today.

samhed commented 3 years ago

Failed to cast media https://r6---sn-uxaxovg-5god.googlevideo.com/videoplayback..... Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

Failed to cast media https://www.home-assistant.io/images/cast/splash.png. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

samhed commented 3 years ago

Things worked fine yesterday. I didn't make any changes to home assistant or to my cast devices for a couple of weeks.

Here's a community thread with more people having the same issue: https://community.home-assistant.io/t/media-play-does-not-work/241696/18

emontnemery commented 3 years ago

Please note that the error message does not state that the URL is not publicly resolvable, it's trying to hint that a common issue causing the cast to not play the requested media is that it's not publicly resolvable. Agreed that the error message is really confusing though, any suggestion for how to make it clearer would be appreciated.

To debug why the casts are not able to cast, please enable these logs, and attach a log (zip it, then drag and drop the zip to a github comment).

@samhed do you also get unexpected attempts to cast https://www.home-assistant.io/images/cast/splash.png on audio only casts?

 logger:
   default: info
   logs:
     homeassistant.components.automation: debug
     homeassistant.core: debug
     homeassistant.components.cast: debug
     homeassistant.components.cast.media_player: debug
     pychromecast: debug
     pychromecast.discovery: info
     pychromecast.socket_client: debug
     homeassistant.components.zeroconf: debug
     zeroconf: info
samhed commented 3 years ago

Thanks @emontnemery, I'll enable the debug logs tonight.

Your question about "splash.png" helped me narrow down my issue. Things seem to work if I cast an audio-only playlist from YouTube music, but not when video is involved. When casting audio-only playlists the audio is played as normal and I don't get the error in the logs.

Text-to-speech works as well.

andriej commented 3 years ago

Before any debugging starts - may it be connected with media_player device_class? By default, google home minis don't have device_class: speaker declared, so it may be somehow connected with casting the splash?

samhed commented 3 years ago

For the record, I have both a Gen 3 Chromecast and a Nest Mini, both behave the same way. Neither of them seem to have a device_class when inspecting the entities in developer tools.

emontnemery commented 3 years ago

Interesting, @samhed can you explain the steps you follow to cast the youtube playlists?

samhed commented 3 years ago

Here's home-assistant.log with debug enabled like you described:

home-assistant.zip

The steps to cast a YouTube Music playlist reproducing the problem:

  1. install yTube Music Player from HACS
  2. set it up to play on your cast device
  3. add media player card for media_player.ytube_music_player
  4. using the Media Library browsing of yTube Music Player - select a song with a music video (for example "Massive Attack - Angel")
  5. observe that no music starts and the above mentioned error shows in the HA interface log view

Things work when I in step 4 select a song without a music video (for example "2pm - Tetris").

I also see this error on startup, might be related: https://github.com/KoljaWindeler/ytube_music_player/issues/62

Lastly, its worth noting as well that earlier when I wrote:

I didn't make any changes to home assistant or to my cast devices for a couple of weeks.

I had forgotten that I did update to HA 2021.1.5 a few days ago due to the security bulletin. Perhaps that caused some sort of issue.

easyservices commented 3 years ago

Hi there, exactly the same issue for me with the Home Assistant 2021.1.5 version. Whatever the URL is...it says unreachable however the URL is reachable from the device itself (same network domain, same ip range, etc).

KoljaWindeler commented 3 years ago

Hi, that error pop's up for every single song when playing youtube music on my Chromecast BUT every song plays without a problem. Could this be related to the lengh of the path? the youtube music links are super long. Cheers

andriej commented 3 years ago

I don't play youtube music at all. It's even with the TTS done to the speaker on my side.

cbakkerprive commented 3 years ago

Same issue here. Unfortunately my Home Assistant cannot give any audio messages because of this.

Logger: homeassistant.components.cast.media_player Source: components/cast/media_player.py:355 Integration: Google Cast (documentation, issues) First occurred: 8:50:15 AM (6 occurrences) Last logged: 8:58:18 AM

Failed to cast media https://www.home-assistant.io/images/cast/splash.png. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address Failed to cast media https://192.168.1.180:8123/api/tts_proxy/9e472f09082bb797429d07545c323836b7d175c0_nl-nl_a9c18110b0_cloud.mp3 from internal_url (https://192.168.1.180:8123). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address Failed to cast media https://192.168.1.180:8123/api/tts_proxy/486ba457e5079b88c81e3f2abb7ec706086d9761_nl-nl_a9c18110b0_cloud.mp3 from internal_url (https://192.168.1.180:8123). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

cbakkerprive commented 3 years ago

@emontnemery : please find the log according your request attached Thanks!

home-assistant.zip

cbakkerprive commented 3 years ago

The issues seems to be related to home assistant local not being accessibele through https. I'm using Nabu Casa Home Assitant Cloud.

When i put my Home Assistant Cloud URL (e.g. https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.ui.nabu.casa) into the HA General Setting External URL, then I can play music (an .mp3 from my HA media folder) on a Google Nest mini.

andriej commented 3 years ago

Mine: both local and external URL - is proper HTTPS on resolvable domain (the same).

cbakkerprive commented 3 years ago

Mine: both local and external URL - is proper HTTPS on resolvable domain (the same).

In my opinion not so much a question of "proper". With Home Assistant Cloud local https seems redundant to me.

EmilyNerdGirl commented 3 years ago

Mine: both local and external URL - is proper HTTPS on resolvable domain (the same).

Same here too. I also changed mine to the*.ui.nabu.casa link to see, and still get the error

cbakkerprive commented 3 years ago

Yes! Since the latest core update Cast works perfectly! Thanks!

cbakkerprive commented 3 years ago

Unfortunately, cheered too soon.

lovelace TTS works fine, lovelace media player with mp3 from HA media folder works fine, but play_media from HA www/sounds folder still doesn't work.

My test automation in YAML:

alias: Slow-motion-sound-effect description: '' trigger: [] condition: [] action:

Should work, but results in the folowing error:

Logger: homeassistant.components.cast.media_player Source: components/cast/media_player.py:354 Integration: Google Cast (documentation, issues) First occurred: 10:53:57 PM (2 occurrences) Last logged: 10:53:57 PM

Failed to cast media https://192.168.1.180:8123/local/sounds/Slow-motion-sound-effect.mp3. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

Note: pasting the URL (https://192.168.1.180:8123/local/sounds/Slow-motion-sound-effect.mp3) in my local computer browser does play the mp3 on my local computer speaker.

cbakkerprive commented 3 years ago

After all it works linke a charm for me when using my external url for the media_content_id. So using media_contentid: 'https://wddabbxxxxxxxxxxxxxxxxxx.ui.nabu.casa/local/sounds/Slow-motion-sound-effect.mp3'_ Instead of 'https://192.168.1.180:8123/local/sounds/Slow-motion-sound-effect.mp3'

Because I did not understand why, I created a Nabu Casa ticket. Here I was helped perfectly by Ashton. He stated that for the internal URL http:// should be used instead op https://. Unfortunately this did not work for me. But: I found that the issues were caused by some duckdns leftover in my configuration.yaml file (before my Nabu Casa subscription I used DuckDNS with port forwarding).

After removing the duckdns leftovers _(being the the duckdns ssl_certificate: /ssl/fullchain.pem and sslkey: /ssl/privkey.pem lines) from my configuration.yaml file everything work perfectly!

Note: HA core-2021.3.4

hjelte commented 3 years ago

This is a true mystery... Suddenly local files wont play! Is there any clear fix for this? Its been working just fine!

this works

talk:
  alias: talk
  sequence:
  - service: tts.google_translate_say
    entity_id: media_player.altanen
    data:
      message: ‘This is a message‘
      #language: sv
  mode: restart

this doesnt work

siren:
  alias: siren
  sequence:
  - service: media_player.play_media
    data:
      media_content_type: video
      media_content_id: media-source://media_source/local/media/siren_alarm.mp4
    target:
      entity_id: media_player.altanen
  mode: restart

this works

extsiren:
  alias: external siren
  sequence:
  - service: media_player.play_media
    data:
      media_content_type: video
      media_content_id: https://www.nordicsmarthomes.se/wp-content/uploads/2021/03/siren_alarm.mp4
    target:
      entity_id: media_player.altanen
  mode: restart
github-actions[bot] commented 3 years 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.