Output audio files to speaker?

I am trying to get HA to output audio to a speaker. I assumed my Echo devices would be able to do this but discovered that Amazon blocks that from happening. Does anyone know if a Google Home mini speaker will do that or does Google lock those down also?
My next option is trying to use my Yamaha AV Receiver. Has anyone done this or if someone can point me in the right direction to how to set this up that would be great.

Hi, have you seen this: Alexa Devices - Home Assistant

It might help if you give a little more detail about what you are trying to do.

It is possible to have Alexa devices play relatively short audio files as long as they are externally accessible and meet the other requirements imposed by Amazon.

I don't use Google smart speakers, but my understanding is that most of them support the Google Cast protocol to stream from local sources.

There are two Yamaha-related integrations in core... I don't personally know anything about them.

What kind of audio? How are you trying to get the audio output? Give us as much info as possible, otherwise we're just guessing at what you're actually trying to do from a technical perspective.

I don't know if Alexa Routine is still supported, but it works for me.
This Node Red node lets me send text to speech to any of my Alexa devices, also audio files and it accepts SSML directives. It also lets me send text to Alexa as if I had spoken it to an Echo device.

I am trying to get my smart speakers to play the same song that my Samsung washer plays when the machine is done. I have other things in mind if I can get this to work, but this was my first attempt to play a file from HA.

That should definitely be possible.

Amazon requires that the audio file meets the following requirements:

  • File type - Only the following formats are supported:

    • aac
    • mp3
    • ogg
    • opus
    • wav
  • Bit rate - The bit rate must be less than or equal to 1411.20 kbps.

  • Sample rate - The sample rate must be less than or equal to 48kHz.

  • File size - The file size of the audio clip can't be greater than 10 MB. If your file size is larger than 10 MB, consider editing the duration of the file or converting the file to another format, such as MP3 or Opus.

  • Response length - The combined total time for the entire audio response generated from the components can't be more than 240 seconds.

The file must be accessible externally, either hosted somewhere on the public internet or in your , externally exposed, HA instance's www directory. The following example assume you are using a locally held file. If the file is available on the public internet, just use that web address.

If you are using the core Alexa Devices integration:

action: notify.send_message
data:
  message: |
    <audio src='https://YOUR_HA_EXTERNAL_ADDRESS/local/YOUR_LAUNDRY_SOUND.mp3'/>
target:
  entity_id: notify.example_dot_speak

For use with the custom Alexa Media Player integration:

action: notify.alexa_media
data:
  data:
    type: tts
  message: |
    <audio src='https://YOUR_HA_EXTERNAL_ADDRESS/local/YOUR_LAUNDRY_SOUND.mp3'/>
  target: media_player.example

I am not having any luck getting this to work. The mp3 meets all the specs. I might be getting the public HA address wrong. I am using my Nubu Casa address of https://xxxxxxx.ui.nabu.casa/homeassistant/www/samsung_washing_optimized.mp3
I have also tried https://xxxxxx.ui.nabu.casa/local/samsung_washing_optimized.mp3 with no luck. I am using the Alexa Devices integration. Am I missing anything?

You need to use local as I did in my example, that's where HA exposes the www directory.

Without seeing the rest of the automation config, we have no way to know...

Did you make sure to change the entity ID to your entity?

Here is the YAML of the automation:

alias: Washer Complete
description: ""
triggers:
  - device_id: xxxxxx
    domain: select
    entity_id: xxxxxx
    type: current_option_changed
    trigger: device
    from: run
    to: stop
conditions: []
actions:
  - action: notify.send_message
    data:
      message: >
        <audio
        src='https://xxxxxx.ui.nabu.casa/local/smsung_washing_optimized.mp3'/>
    target:
      entity_id: media_player.den_echo_show
mode: single

Is that file name spelled correctly in your actual automation?

Have you checked that the file is available at the address by pasting it into a browser?

That is the correct filename. However, I get a 404 error when I paste it into a browser. How can I verify the file path of the mp3?

it doesn't say samsung, but smsung , as Didgeridrew asked, could that be the reason ?

That was a typo on the post. I verified the correct spelling of the file and of the URL. Do I have to do anything to expose the www folder to the web or is it exposed by default?

Ok, i was just in doubt , i have no experience of exposing /local to the web, and im not sure why you need that if you use an internal media.player

Might be better to ask for an FR in the Smart-thing Integration, as it's a builtin feature in Samsung Washer, and available in the Smartthing Phone APP

PS: Does the rest of your automation work ?, will it send an "ordinary" notify.notify to your phone ?

IIRC, it should just be exposed as long as you have remote access enabled.

Did you have to manual create the www folder or was it already there? If you created it manually, you should restart HA to make sure it is being loaded. Actually, even if it was already there you added a new file to it, so you should restart to load that.

I dont have an issue with the Smarthings integration. When the washer stops, I can trigger other automations. I'm trying to get the tune to play over a speaker. I already downloaded the audio file

The www folder was already there. Should the nubu casa url bypass authentication to get to the local folder? How would I make sure the URL is authenticated from an outside source?

An FR is a Feature Requests, the Feature is there in the Washer and in the Phone App, thou not in the HA-Integration ( Could be do to the fact that it's hardcoded in the Samsung Washer

:red_question_mark:

OP is trying to play a locally-held audio file on an Amazon Alexa device, which is Cloud-dependent. The file has to be accessible to Amazon's servers. It has nothing to do with Samsung except that was the original source of the sound.