Script to resume Google Cast devices after they have been interrupted by any action

Sorry for my late response, I’ll try to find something which should support that

Resuming YTM on Nest Minis when started via OK Google command would be that great. Looking for a solution since 2 years.
Can’t somebody with more influence than a single user as I am contact YTM do build an official API? I used the feedback form in the app a dozen times.

Unfortunately there is nothing I can do about that as well. Would be nice if a similar solution as for Spotify would be possible

The script is not resuming after TTS. Is anyone able to take a look at my traces, please? I am getting no errors in the logs.

Google Home Resume Helper Script Trace
Google Home Resume Script

@Jakesa According to the player data in lines 93 - 138 of the main script, there was nothing playing when the script was started. There was one player paused and one idle and he other players were off

hmm, that is weird because it definitely is playing.

I just tried it again this time making sure the media player was showing as playing in the UI

but the script says the player was off - Goole Home Resume

I doubt it is related, and maybe I am misunderstanding it, but the timestamps seem to be an hour behind within the trace but the time stamp in the UI is correct:

What is your local time zone? The timestamps in the trace are in UTC. So if you are on British Summer Time that would be correct

The trace shows you are using the automation, as also mentioned in the documentation I advice against that. Does it work if you start the script directly?

Yes it is BST so that makes sense.

As for the automation, I didn’t think I was using it but maybe I have got confused.

service: script.google_home_resume
data:
  target:
    entity_id: media_player.google_speakers_exc_g
  action:
    - service: tts.cloud_say
      data:
        entity_id: media_player.google_speakers_exc_g
        message: Jake, you have unread mail

I have been trying to replicate your example script “Send TTS and apply volume for the TTS message”

test:
  alias: test send tts using google home resume script
  sequence:
  - service: script.turn_on
    target:
      entity_id: script.google_home_resume
    data:
      variables:
        action:
        - service: tts.cloud_say
          target:
            entity_id: media_player.google_speakers
          data:
            message: Ding Dong! There is someone at the door!
          extra:
            volume: 0.5

but this also didn’t work for me and the script still says the speakers are off. Google Home Resume

If you are not using the automation, then turn it off, either in the settings of the script or disable the automation in the HA automation GUI. Your traces show that the script is triggered by the automation.

Sorry I see what you mean by the automation now. I have now disabled it in the UI

But it didn’t resume after Google Resume, in this example tunein was playing on the kitchen_display but is shown as off in the script.

Can you share a trace note now that the automation is disabled? If you disabled it in the script settings, did you reload customization, scripts and automations in developer tools > yaml afterwards (or did you do a full YAML reload)

The trace above was after disabling the automation. I tried it again here just in case. I did a full YAML reload.

Edit: Sorry, I just re-read your response. Should I be disabling the script or the automation? I disabled the google resume automation in the automation settings

The automation should be disabled. I’ll check your trace ASAP

1 Like

Is media_player.google_speakers a speaker group created in the Google Home app, or a speaker group created in HA

It is a group within HA. Does it need to be in the google home app?

edit: I just created one within the Google app and edited the speaker group in script

homeassistant:
  customize:
    script.google_home_resume:
      # enter settings for the script here, all settings are optional, you can remove sections if you don't need them
      # always leave the line with "settings: &settings" in!
      settings: &settings
        primary_spotcast: jacobsach1987
        speaker_groups:
          media_player.home:
            - media_player.main_bedroom_speaker
            - media_player.grace_bedroom_speaker
            - media_player.living_room_speaker
            - media_player.kitchen_display

and I added it in the TTS script too

service: script.turn_on
target:
  entity_id: script.google_home_resume
data:
  variables:
    action:
      - service: tts.cloud_say
        target:
          entity_id: media_player.home
        data:
          message: Ding Dong! There is someone at the door!
        extra:
          volume: 0.5

I have progress!!! It resumed after TTS but the TTS did not perform correctly, it said “Din…” then stopped and resumed the music after a few seconds. - Google Resume

So I now have the resume working but the TTS is not working now.

So now the resume starts too soon. I need some more time to look into this

It seems like it isn’t script related.

If I call a TTS service in developer tools using the Google Home speaker group (media_player.home) without any scripts, It is really hit and miss.

Rarely does it play on all the speakers in the group. It mostly plays the first few milliseconds on speakers:

  - media_player.main_bedroom_speaker
  - media_player.grace_bedroom_speaker
  - media_player.living_room_speaker

and plays normally on:

- media_player.kitchen_display

Not sure if it is related but I’ve noticed media_player.kitchen_display is labelled as default media player in the UI:

I am unsure how or why that is the default speaker, but it seems coincidental it’s the only speaker to handle the TTS service properly.

Annoyingly, I don’t get this behaviour when using speaker groups within HA, its only been since using the Google Home groups this has begun. This is the same for both tts.cloud_say and tts.speak

The script should work with HA media player as well, but I need to look into that.

The default media receiver you see on the hub is the app used to play the TTS, it says nothing about the hub itself.

With a HA group it sends the TTS to the individual speakers, so each speaker will receive it’s own command and will play it’s own mp3.

With the Google Home speaker group it’s one command, and the players will be synced. But it could be that it starts earlier on one speaker and therefore will only be played half on another.

1 Like

Thank you. If there’s anything I can do to help, e.g. testing, I am happy to help.

This script has been a saviour for my HA instance, disheartened that it is no longer working for me.

Seems like the recent core update sorted my issue. Everything working as normal now :man_shrugging:

1 Like