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

Hi @Jokerigno ,

Yes I also noticed some inconsistency too.
I don’t have a google mini but other Chinese products a Mi AI speaker and Mi TV Box box. with built in Chrome cast and these behave differently. So maybe the real Chrome cast behave in yet another way.

Try this a bit modifiede version:

alias: TTS and resume
variables:
  mediaplayer_State: '{{ states(tts_entity) }}'
  mediaplayer_volume_level: '{{ state_attr(tts_entity,''volume_level'') }}'
  mediaplayer_media_content_id: '{{ state_attr(tts_entity,''media_content_id'') }}'
  mediaplayer_app_name: '{{ state_attr(tts_entity,''app_name'') }}'
  mediaplayer_Source: '{{ state_attr(tts_entity,''media_channel'') }}'
sequence:
  - service: media_player.volume_set
    data:
      entity_id: '{{ tts_entity }}'
      volume_level: 0.15
  - service: tts.google_translate_say
    data:
      entity_id: '{{ tts_entity }}'
      language: da
      message: '{{ msg }}'
  - delay:
      hours: 0
      minutes: 0
      seconds: 7
      milliseconds: 0
  - service: media_player.volume_set
    data:
      entity_id: '{{ tts_entity }}'
      volume_level: '{{ mediaplayer_volume_level }}'
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ mediaplayer_app_name == ''Spotify'' }}'
        sequence:
          - service: spotcast.start
            data:
              entity_id: '{{ tts_entity }}'
    default:
      - service: media_player.play_media
        data:
          entity_id: '{{ tts_entity }}'
          media_content_id: '{{ mediaplayer_media_content_id }}'
          media_content_type: music
  - delay:
      hours: 0
      minutes: 0
      seconds: 8
      milliseconds: 0
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ mediaplayer_Source != None }}'
        sequence:
          - service: media_player.select_source
            data:
              entity_id: '{{ tts_entity }}'
              source: '{{ mediaplayer_Source }}'
          - delay:
              hours: 0
              minutes: 0
              seconds: 4
              milliseconds: 0

  - service: media_player.media_pause
    data:
      entity_id: '{{ tts_entity }}'
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ mediaplayer_State == ''playing'' }}'
        sequence:
          - delay:
              hours: 0
              minutes: 0
              seconds: 4
              milliseconds: 0
          - service: media_player.media_play
            data:
              entity_id: '{{ tts_entity }}'
mode: single

If it still don’t work, please send me the state and attributes values for your media player from the developer tools “states tab”, before and after you call the script?

This will help us figure out what is missing :slight_smile:

4 Likes