Alexa Media Player - Mp3 issue / Cuckoo Clock

I’m assuming Amazon changed something a few days ago. I use the Cuckoo Clock script to play a local mp3 every hour/half hour on my echos.

This has always worked flawlessly, but as of 1/27 it no longer plays the audio and instead I get Alexa telling me “to play TTS, please set announce=true. Music can’t be played this way”. I’m unsure what changed our exactly how to adjust the script to correct for this

Anyone else run into this lately?

2 Likes

Mine is working… post the script or automation you are using and any recent traces of failed runs.

FWIW, there seems to be a widening gulf when it comes to features availability from region to region, so it may helpful if you include where you are in the world so we all know we are comparing apples to apples.

Appreciate the reply. So to start, I’m in the US. I’m not sure i can follow the traces as the automation is in yaml in a package. Included here is the contents of the package itself:

#####################################################################
# Origianl Repo: @chrisron95 - https://raw.githubusercontent.com/chrisron95/home-assistant-config/master/packages/clock_chime.yaml
## Plays the number of cuckoos per hour and 1 on the half hour.
# More Info and Video: https://www.vcloudinfo.com/2017/11/building-digital-cuckoo-clock-with-home.html

# Modified from Chris Heder (@chrisron95) for Maison Des Lunes
# Setup package to make everything configurable.
# Added:
#   - Ability to select sound between Cuckoo and Grandfather Clock
#   - Quarter toll ability
#   - Ability to disable quarter and half tolls, and chime entirely
#   - Time helpers for start and stop times.
#
# Changed:
#   - Now runs every 15 minutes rather than only every half hour
#   - Triggers have IDs now which allows me to replace the time templates
#####################################################################

input_boolean:
  clock_chime:
    name: Clock Chime
    icon: mdi:alarm
  clock_chime_half_toll:
    name: Clock Chime Half Hour Toll
    icon: mdi:alarm
  clock_chime_quarter_toll:
    name: Clock Chime Quarter Hour Toll
    icon: mdi:alarm

input_datetime:
  clock_chime_on_time:
    name: Clock Chime On Time
    has_date: false
    has_time: true
  clock_chime_off_time:
    name: Clock Chime Off Time
    has_date: false
    has_time: true

input_select:
  clock_chime_sound:
    name: Clock Chime Sound
    options:
      - Cuckoo Clock
      - Grandfather Clock
    icon: mdi:bell-ring

automation:
  - alias: Clock Chime
    id: clock_chime
    mode: restart
    # Trigger every 15 minutes. The ID lets you know which one is current, rather than a time template.
    # This accounts for the delay when waiting for media player to stop playing, just in case it lasts too long.
    trigger:
      - platform: time_pattern
        minutes: 0
        id: "0"
      - platform: time_pattern
        minutes: 15
        id: "15"
      - platform: time_pattern
        minutes: 30
        id: "30"
      - platform: time_pattern
        minutes: 45
        id: "45"

    condition:
      - condition: time
        after: input_datetime.clock_chime_on_time
        before: input_datetime.clock_chime_off_time
      - condition: state
        entity_id: input_boolean.audible_notifications
        state: "on"
      - condition: state # Make sure the chime is enabled.
        entity_id: input_boolean.clock_chime
        state: "on"
      - condition: or # Either we are home or Guest_Mode is on.
        conditions:
          - condition: state
            entity_id: binary_sensor.family_home
            state: "on"
          - condition: state
            entity_id: input_boolean.guest_mode
            state: "on"

    action:
      - choose:
          # Check for quarter and half hour trigger, and stop if it should be disabled.
          - conditions:
              - condition: or
                conditions:
                  - condition: trigger
                    id: "15"
                  - condition: trigger
                    id: "45"
            sequence:
              - condition: or
                conditions:
                  # Don't play the quarter toll if it's disabled.
                  - condition: state
                    entity_id: input_boolean.clock_chime_quarter_toll
                    state: "off"
                  # Also don't play the quarter toll if Cuckoo Clock is selected as it's not needed.
                  - condition: state
                    entity_id: input_select.clock_chime_sound
                    state: Cuckoo Clock
              - stop: "Quarter Toll Disabled"
          - conditions:
              - condition: trigger
                id: "30"
            sequence:
              # Don't play the half toll if it's disabled.
              - condition: state
                entity_id: input_boolean.clock_chime_half_toll
                state: "off"
              - stop: "Half Toll Disabled"
        default: []
      - if:
        - condition: state
          entity_id: media_player.kitchen_dot
          state: 'idle'
        then:
        - service: media_player.volume_set
          data:
            entity_id: media_player.kitchen_dot
            volume_level: 0.25
        - service: media_player.play_media
          data:
            entity_id: >
                media_player.kitchen_dot
            media_content_id: >
              {% if states("input_select.clock_chime_sound") == "Cuckoo Clock" %}
                  {% if trigger.id == "30" %}
                    https://slackerlabs.s3.amazonaws.com/audio/cuckoo/cuckoo-clock-01.mp3 
                  {% else %}
                    https://slackerlabs.s3.amazonaws.com/audio/cuckoo/cuckoo-clock-{{now().strftime("%I")}}.mp3
                  {% endif %}
                {% elif states("input_select.clock_chime_sound") == "Grandfather Clock" %}
                  {% if trigger.id == "15" %}
                    https://slackerlabs.s3.amazonaws.com/audio/gfclock/toll-1quarter.mp3
                  {% elif trigger.id == "30" %}
                    https://slackerlabs.s3.amazonaws.com/audio/gfclock/toll-2quarter.mp3
                  {% elif trigger.id == "45" %}
                    https://slackerlabs.s3.amazonaws.com/audio/gfclock/toll-3quarter.mp3
                  {% else %}
                    https://slackerlabs.s3.amazonaws.com/audio/gfclock/{{now().strftime("%I")}}-hour.mp3
                  {% endif %}
                {% endif %}
            media_content_type: music
        else:
        - service: script.jarvis_voice
          data:
            who: kitchen
            message: > # Use the trigger ID to specify which sound to play.
              {% if states("input_select.clock_chime_sound") == "Cuckoo Clock" %}
                {% if trigger.id == "30" %}
                  <audio src='https://slackerlabs.s3.amazonaws.com/audio/cuckoo/cuckoo-clock-01.mp3'/>
                {% else %}
                  <audio src='https://slackerlabs.s3.amazonaws.com/audio/cuckoo/cuckoo-clock-{{now().strftime("%I")}}.mp3'/>
                {% endif %}
              {% elif states("input_select.clock_chime_sound") == "Grandfather Clock" %}
                {% if trigger.id == "15" %}
                  <audio src='https://slackerlabs.s3.amazonaws.com/audio/gfclock/toll-1quarter.mp3'/>
                {% elif trigger.id == "30" %}
                  <audio src='https://slackerlabs.s3.amazonaws.com/audio/gfclock/toll-2quarter.mp3'/>
                {% elif trigger.id == "45" %}
                  <audio src='https://slackerlabs.s3.amazonaws.com/audio/gfclock/toll-3quarter.mp3'/>
                {% else %}
                  <audio src='https://slackerlabs.s3.amazonaws.com/audio/gfclock/{{now().strftime("%I")}}-hour.mp3'/>
                {% endif %}
              {% endif %}

Hopefully this helps to start.

EDIT: After checking…traces seem fine. It does execute as expected, technically speaking, becuase it goes off every hour and every half hour…only instead of playing the mp3 clip, it repeats the message about ‘music can’t be played this way’

I’m actually kind of surprised that has been working for you this long… I think it was only working because the previous behavior from Alexa was to ignore it, but now it gives you the error message. And the second services call gets dumped by Alexa because she’s in the middle of reading the error message.

If you check Jeff’s original version (and the one it was based on) the media_player.play_media service call was not meant to be targeted at an Alexa device. So, all you need to do is remove the action using media_player.play_media.

Perfection! You’re right, it must have just been ignoring the incorrect code up until the other day.

Now, can it be set to play it on multiple echos simultaneously by setting it as an entities list? Or does it have to be sent to a group of echos?

Thanks for the help! Glad to hear my chime again and not her talking lol

I don’t remember how Jeff has script.jarvis_voice set up… it might not take multiple players for the value of who. Generally, you have to list the target players. AFAIK it will not work if targeted on Alexa’s speaker groups.

FWIW, you can see the automation I use here.

1 Like