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

Update

Version 2022.11.3 - 23 November 2022

:red_circle: BREAKING

  • All player_data is now stored in one go, the Google Home Voice and Google Home Event script are using the exacte same template now to make it easier to update and improve it. Also update the Google Home Voice and Google Home Event scripts if you use those as well.

:star2: Improvements

  • Used more YAML anchors to avoid repeating code
  • A lot of minor template improvements

:bug: Bug fixes

  • Several fixes in both the script and automation

Sorry for all the bugs in the new 2022.11 version. Hope it works again for all of you now!

1 Like

This should be fixed now, there were some issues with the spotcast account on 2022.11 versions prior to 2022.11.3

Sorry, I see I need to clarify this.

The automation is not used if you already provide the actions when calling the script.
The automation should kick in if you send a TTS, or play a file with announce: true set without using the script. The automation will be triggered on the service call, and trigger the script, so the current stream is also resumed.

1 Like

Thank you for the update. But I still get warning messages.


It came from automation
https://www.dpaste.org/a8isw

sorry, forgot a comma there… :poop:
2022.1.4 incoming

I recently bought a nest hub 2nd gen. I tried playing video on youtube and run the test script to play good morning audio file. It will interrupt the video and announce but it doesn’t resume. Do I have to setup stuff like on spotify or is it automatic?

Version 2022.11.4 - 22 November 2022

:bug: Bug fixes

  • :shit: forgot a comma in a template
1 Like

Did you add the entity to the players_screen section in the settings? That’s required for YouTube resume.

Yes, I added the entity of the nest hub

Sorry, I had a closer look at the trace. You did not update to the 2022.11 version yet.
This error is caused because you did not add the account tot the spotcast configuration, or the account name doesn’t match the entity from the Spotify integration.
In any case, the account is not known by the spotcast integration, and therefore the spotcast.start service call errors.

So you need to update the configuration for the spotcast integration to add the milena_dacheva account, and the entity from the Spotify integration should match this account, so that one needs to be media_player.spotify_milena_dacheva

Did you reload SCRIPTS configuration after this? You can do that in Developer Tools > YAML
Best to also reload LOCATION & CUSTOMIZATIONS as well.

I will add some info to the instructions about changing settings.

If you did, please send me traces of the main and helper script.

I updated to the latest version the warning logs are now gone. :smiley:

I clicked the check configurations and pressed the restart button.

A restart was not needed, you can just reload the above mentioned parts. But a reboot should also do the trick.

Can you send the traces then?

Yes sure! I will collect the traces now.

I still didn’t update yet to Home Assistant Core 2022.11.4. Does this affect the functionality of the script?

No, that shouldn’t matter.

https://www.dpaste.org/TzAxc
https://www.dpaste.org/Tjt6O

The entity id of your new device is media_player.dining_room_display, you added this to the players_screen list: media_player.media_player.dining_room_display
Remove one of the two media_player. parts :slight_smile:

Same applies to the other device in that list.

1 Like

Haha, it works now. Thank you! :smiley:

1 Like

Hmmm… something went wrong.

Logger: homeassistant.components.script.google_home_resume
Source: helpers/script.py:409
Integration: Script
Last logged: 9:08:25 AM

00 - Google Home Resume: Error executing script. Error rendering template for variables at pos 8: TypeError: argument of type 'NoneType' is not iterable

trace: dpaste/sYRw7 (Python)