Amazon Echo: How to set the volume and play mp3 files?

Hello,
is there a way to set the volume for the echoes and play a specific Mp3 file?

The background is this: I would like to use the echoes as a (stupid) alarm system and play a siren or a beep. Before the sound is played, the volume should be high. After playback, the Echo should return to normal volume.

Thank you.

1 Like

You can control volume using the standard Home Assistant media player service calls i.e media_player.volume_set when you have the Alexa Media Player (AMP) custom integration installed.

Playing a specific mp3 is a little more complicated. Similar to the answer concerning volume control, AMP enables using the media_player.play_media service for your Echo devices. However, Amazon limits direct streaming of local mp3 files.

3 Likes

Thank you!
How do I use “media_player.volume_set” in an automation?
This is the code:

alias: "Alarm: Zeitverzögerung Gehen (Einschalten)"
description: ""
trigger:
  - platform: state
    entity_id:
      - alarm_control_panel.alarm_zuhause
    from: disarmed
    to: arming
condition:
  - condition: state
    entity_id: alarm_control_panel.alarm_zuhause
    state: arming
action:
  - service: notify.alexa_media_echo_buro_matthias
    data:
      message: Noch 10 Sekunden bis die Alarmanlage scharf geschalten ist.
  - service: alarm_control_panel.alarm_trigger
    data: {}
    target:
      entity_id: alarm_control_panel.alarm_zuhause
mode: single

Media Player Usage Examples

  - service: media_player.volume_set
    data:
      volume_level: 0.3
    target:
      entity_id: media_player.echo_buro_matthias
1 Like

Thanks very much! I can now change the volume and got it. I didn’t realize that this command can also be found under “call service” in the graphical editor.

Unfortunately, I can’t solve the second problem without help either. I’m trying method 3 because it seems the easiest to me. Where do I write this code?

{
“entity_id”: “media_player.guest_room”,
“media_content_id”: “amzn_sfx_doorbell_chime_01”,
“media_content_type”: “sound”
}

I actually read the documentary. But I couldn’t find this info as a beginner.

Edit: I got it:

service: media_player.play_media
data: 
  media_content_type: sound
  media_content_id: amzn_sfx_doorbell_chime_01
target:
  entity_id: media_player.echo_buro_matthias

I’m glad you figured it out… I don’t know why, but some of the AMP documentation has the service calls shown as in that javascript-type format and some of it is in the standard yaml used in Home Assistant. Just in case you see it elsewhere in the future, you can configure the service call using the javascript format as follows:

service: media_player.play_media
data: {
  "media_content_type": "sound",
  "media_content_id": "amzn_sfx_doorbell_chime_01"
  "entity_id": "media_player.echo_buro_matthias"}
1 Like