#Determining Media PATH/URL

18 messages · Page 1 of 1 (latest)

crimson edge
#

So, I've gone ahead and uploaded a file to my HA setup. It shows under My Media:

I want to be able to send it to a Google Mini.

The automation action looks like this:

action: media_player.play_media
metadata: {}
data:
media_content_type: audio/mp3
media_content_id: " /media/wn.mp3"
target:
device_id: 66a7d11344742aa7a095135676f008a7

The problem I've got right here is that I have no idea what the type is supposed to be, so that's a guess based on someone's previous post. The media_content_id, likewise. I've poked all around and I can't find the actual correct path.

And so I'm looking for help.

shy kindle
#

Use the whole URL, "https://ipaddress:8123/media/wn.mp3"
Remember that to send stuff to your google speakers, it is a cloud based thing and it needs the full URL in order to find it.
Also your external_url stuff has to be correct and you cannot be using self-signed certs it you are using https://. Google won't use them.

crimson edge
#

So does the URL need to be publicly accessible from the cloud, or is it good enough for the Mini to be able to reach the URL on the HA server?

#

Also, if I try my correct address (http://192.168.1.221:8123/media/wn.mp3) I get a 404.

I've uploaded the file using the media tab in HA, but I can't upload to the base folder, so I end up having to go Under "My Media" to do the actual upload, if that changes the path.

shy kindle
#

I played with trying to display things a couple of times, and it just made me angry. The TTS stuff takes care of a lot of the paths to the cache so as long and my external_url is pointed at Nabu that all works well for me.

toxic tapir
#

Yeah, all this Media stuff is so annoying. I can't find good way to provide file via YAML, if it was added via media upload. So for my bells and sirens i just upload to config/www/sounds dir (with File Explorer), and use http://ha_ip:8123/local/sounds/... address.
IDK if Google device will accept local url though. It should, if you're using Cast. But you can use your public domain name there.

crimson edge
#

OK, so to make sure I've got the entire concept straight here.

First off, I can't create a folder named "sounds" via ssh or winSCP. So, that's kind of annoying. So, let's ignore that and stick my file in /config/www as wn.mp3

Meaning my http path to it should be http://192.168.1.221:8123/local/wn.mp3 (I think, from what y ou're saying)

#

And that works. So, that's step one down.

However, if I try to run this action:

#

I get the announcement doink from the Mini telling me it's about to play something, but no audio. So I assume that means either my content type is wrong, or my audio file needs to be internet accessible?

#

So, if I point the automation to the actual web URL that I grabbed the file from in the first place, it works. It seems nuts to need to hit an outside URL for something that is located directly on the HA box.

toxic tapir
#

That's one of downsides with vendor-locked products...
On Alexa, you also need to convert audio file to exact sample and bit rates in order to be playable. 🙂
I use Music Assistant. My cast devices added to MA as players, and from HA I can use local URL to play on MA players.

crimson edge
#

I've got MA installed. But I couldn't see how to even reference MA in automations.

toxic tapir
#

I added MA players to HA. There's integration for it. Then just play http link on them.

crimson edge
#

I've got MA as an add-on. Although it's MA Server, and to do anything with it I need to navigate in via add-ons, and the Open WebUI link on that page. Which seems kind of odd to me:

crimson edge
#

OK, so I forgot about HACS (I always forget about HACS) and so got the integration integrated.

#

But I don't know how to format the URI for either local storage or a straight up web URL