How continue play the previous music after a tts voice announcement?

I have exactly the same problem with my HomePod. Any ideas?

Music Assistant supports Spotify, Youtube, TuneIn (and others) and also resuming after TTS.

@larsnormark, @Schlichi83

Correct, but you’ll run in to a million other problems. It’s another layer of stuff that can break. In my experience, 1. It keeps crashing the APP on iPhone, 2. It’s not always resuming, 3. If you choose artist Guns n’ roses, it will play what it finds and then suddenly you have pop, country or something not in that genre. In the end I removed Music Assistant as it was causing more headaches than anything else.

Music Assistant 2.0 is just about out of beta. Many, many improvements. I’m using it with an array of google and other assorted media devices (including browser mod players) with local media, Spotify, YouTube, TuneIn, TTS. I’m not really experiencing very many bugs in my setup any longer. It’s not “perfect” yet but it’s getting much closer! I believe the creator of MASS is actually working for NabuCasa now which probably helps.

If it’s been a while since you’ve played around with MASS I recommend giving it another whirl!

Even in Music Assistant resume after TTS is not working

For those who prefer not to use Music Assistant the broadcast feature in the Google SDK integration is a good alternative to have announcements on google devices without stopping any media that is currently playing. I’ve been testing it out and works great.

1 Like

If you could throw an example script not to start from scratch - that would have been awesome :slight_smile:

Install the integration and use Developer tools → Services and try it out. The target is the device’s name in your Google Home app.

Click on YAML Mode to get the YAML code.

Here is my tts message script if you want to see how I used it in my config.

Here’s how I was able to resume music playing through Music Assistant when tts.google_translate_say speaks any announcements on the Google Home Mini speaker in the kitchen.

The logic:

IF: the Kitchen Music Assistant Media Player is playing music

THEN:

  • pause the Kitchen Music Assistant Media Player
  • speak the announcement on the REGULAR Kitchen Media Player (not the Music Assistant Media Player)
  • wait for the announcement to complete on the REGULAR Kitchen Media Player
  • play the music on the Kitchen Music Assistant Media Player

ELSE: speak the announcement on the REGULAR Kitchen Media Player

Why it works:

The Kitchen Music Assistant Media Player can be paused, and then played – easy enough.

Sending the TTS command to the Regular Kitchen Media Player does not clear the queue from the Kitchen Music Assistant Media Player.

Here’s my automation code

- id: "20230210-23"
  alias: Speak the time in the kitchen at 11:30 am
  description: ""
  trigger:
    - platform: time
      at: "11:30:00"
  condition:
    - condition: zone
      entity_id: person.husband
      zone: zone.home
   - condition: zone
      entity_id: person.wife
      zone: zone.home
   action:
    - if:
        - condition: state
          entity_id: media_player.kitchen_music_assistant
          state: playing
      then:
        - service: media_player.media_pause
          data: {}
          target:
            entity_id: media_player.kitchen_music_assistant
        - service: tts.google_translate_say
          data:
            entity_id: media_player.kitchen
            message: >-
              The time is {{ now().strftime('%-I:%M %p') }}.
        - wait_for_trigger:
            - platform: state
              entity_id:
                - media_player.jareaus_office_speaker
              to: idle
          timeout:
            hours: 0
            minutes: 0
            seconds: 5
            milliseconds: 0
        - service: media_player.media_play
          data: {}
          target:
            entity_id: media_player.kitchen_music_assistant
        - service: tts.clear_cache
          data: {}
      else:
        - service: tts.google_translate_say
          data:
            entity_id: media_player.kitchen
            message: >-
              The time is {{ now().strftime('%-I:%M %p') }}.
  mode: single
4 Likes

May I ask what that script is for? I tried to create it but it doesn’t save it, it gives me an error.
For a few weeks I have noticed that for every message made like this with Google SDK, it repeats the messages to me specifying the name of the room used and by forwarding the message to multiple rooms, the message is repeated 3-4 times with all the names of the rooms used. Have you encountered this problem?

It’s a script I use whenever a tts message is to be played. Decides what speakers to play it on, stops any music playing on those speakers, lowers the volume on the rest. Chooses what tts service to use, what volume to play it at based on time of day etc. etc. Highly customized for my system. You won’t get it to work on yours without a lot of changes.

I just posted it to show an example of Google SDK being used.

I have not had any issues with Google SDK. I don’t actually use it that often, but I just tested it and it working as expected for me.

1 Like

This script to works need to use MA to start the music right?

I’m asking because we use voice o spotify app to start streaming and as far as I understand my case does not fit with this use. right?

Hi,

I tried Music Assistan " Play Announcement (advanced) ", it works fine with an mp3 file from an url, BUT I’m stuck to replace that mp3 file by a TTS generated message … Could someone help me ?

Thanks,

action: mass.play_announcement
metadata: {}
data:
  announce_volume: 45
  use_pre_announce: true
  url: >-
    https://audio-previews.elements.envatousercontent.com/files/181619625/preview.mp3
target:
  entity_id: media_player.cuisine

Hi,

I need help so that the TTS messages repeat when using the Music Assistant entity of my Google Home Mini (“Box”) until the corresponding status changes.
Unfortunately, the following script only works when using the standard entity of my Google player, which does not allow the music to continue after the TTS message has ended.
If I use the MA entity, the message is only played once, regardless of whether something is being played or not.

alias: Benachrichtigung_KühlschranktürKüche_Box
description: ""
triggers:
  - entity_id:
      - binary_sensor.kuehlschrank_kueche_idle_open
    to: "on"
    for:
      hours: 0
      minutes: 1
      seconds: 0
    trigger: state
  - entity_id:
      - sensor.shelly_stecker_5_power
    for:
      hours: 0
      minutes: 1
      seconds: 0
    above: 60
    trigger: numeric_state
actions:
  - repeat:
      until:
        - condition: state
          entity_id: binary_sensor.kuehlschrank_kueche_idle_open
          state: "off"
          for:
            hours: 0
            minutes: 0
            seconds: 0
        - condition: or
          conditions:
            - condition: state
              entity_id: binary_sensor.kuehlschrank_kueche_cooling
              state: "on"
              for:
                hours: 0
                minutes: 0
                seconds: 0
            - condition: numeric_state
              entity_id: sensor.shelly_stecker_5_power
              below: 1
      sequence:
        - metadata: {}
          data: {}
          target:
            entity_id: media_player.box
          action: media_player.clear_playlist
          enabled: false
        - data:
            cache: true
            media_player_entity_id: media_player.box
            message: Kühlschranktür ist auf!
          action: tts.speak
          target:
            entity_id: tts.google_de_de
        - wait_template: "{{ is_state('media_player.box', 'idle') }}"
          enabled: true
mode: single

Thanks you for any help!