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

Aaaannd - back :slight_smile:

As of lately Iā€™m now having partial resume. Has Spotify changed something? (Livingroom resumes, Kitchen doesnā€™t and complains ā€œSpotify account is used on another accountā€.

https://www.codepile.net/pile/yXBd6ZYN

Iā€™m having that issue just by telling Google to play something on spotify. Think its just a general spotify issue.

How did you start this Spotify stream? Is it playing on a speaker group, or did you change the output speakers in the Google Home app or on your Nest Hub or whatever.
Could you send the trace of the main script instead of the Perform resume script?

It kinda seems like the resume is performed on the individual members instead of on the group (if a group has been used).

1 Like

Started the Spotify stream on the speaker group (downstairs), then the announcement was played downstairs, then this happenedā€¦

https://www.codepile.net/pile/yj0yOAG8

Fixed in v.2.3.3

1 Like

Update

Version 2.3.3 - 22 April 2022

:bug: Bug fixes

  • Fix for resume of speaker groups

Version 2.3.2 - 18 April 2022

:bug: Bug fixes

  • Fixed a bug caused by storing the volume of a a speaker with state unavailable
  • Fixed restore of volume for non playing entities

Thanks for the recent bug fixes, script is working like a charm again (and also much faster without the Google bell before announcement?!) Thanks!

1 Like

All errors fixed after upgrade to core 2022.4.7 and Script 2.3.3
Thank you.

1 Like

I guess I didnā€™t wrote very clearly. that mp3 file is the doorbell ring that interrupts my radio which is played on my google devices through a script. So I should resume radio , not mp3 file :slight_smile:

Did you actually try the code I suggested? Because that it will do exactly what you describe here.

I am getting an error:


Call service script.google_home_resume
00 šŸ”Š Google Home Resume (script.google_home_resume) started
00 šŸ”Š Google Home Resume (script.google_home_resume) turned on
00 šŸ”Š Google Home Resume (script.google_home_resume) turned off
Stopped because an error was encountered at 27 April 2022, 11:05:08 (runtime: 0.56 seconds)

Entity media_player.stereo_speakers does not support this service.

Any ideas? Thanks!

Could you send the trace of the script? There is information in how to do that in the start post.

1 Like

here it is:

https://www.codepile.net/pile/y09wpyk6

I assume media_player.stereo_speakers is a stereo pair?
It seems that the media_player.turn_on service is not supported by this entity. I use that to turn it on and retrieve the volume.

There is actually a PR which allows turning on speaker groups, and I assume this also accounts for speaker pairs.

Iā€™m already on 2022.5.0b1 so I could check this, but I canā€™t seem to find the option to create Stereo Pairs anywhere in the Google Home app :sweat_smile: did a test, and the turn_on service works fine in 2022.5

2022.5 also introduces the option to continue the script/automation when a service call fails, I will make sure to add this to this service call. However, at this moment I canā€™t do much about this, unless I remove the service call at all (or make it optional), however that would be a lot of work for something that will be an easy fix in less than a week.

Thanks, yes, itā€™s indeed a stereo pair. I will wait and test it again on 2022.5 then.
Probably unrelated: I donā€™t have groups and donā€™t use the radio, so I commented the ā€œradio_dataā€ and ā€œspeaker_groupsā€ bits (rows 37 to 64). Is that right, or doesnā€™t it matter/hurt to keep them as they are?

No, thatā€™s fine. If you donā€™t use them, you can leave it out (or comment it out like you did).

Quick question: Iā€™m confused about compatibility. Is it only compatible with the services you listed, or can I use this script to resume my Apple Music or Pandora streams on my Google Home?

Hi @TheFes, do you intend to add resume script for Flex Media ?

I assume you mean Plex here, and not Flex. Flex is something Iā€™ve never seen before.
I donā€™t have a Plex server, so this is tricky for me to add and support. Iā€™m not sure what kind of service calls are used to start media.

@ryantrip the same applies to your request, I donā€™t use Apple Music and Pandora, and I donā€™t know how resume for these services would work. Pandora isnā€™t available in the Netherlands, so I canā€™t even test that.

Update

Version 2.4.0 - 5 May 2022

:red_circle: BREAKING

  • Due to implemented changes introduced in 2022.5 this version is now required for the script

:star2: Improvements

  • Merged the Perform Resume and Restore Non Playing devices helper scripts into one script
  • Code review and implementation of new script actions introduced in HA 2022.5