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

The entire home assistant crashes with the new script.

this is the error message : Error loading /config/configuration.yaml: found undefined alias ‘voice_settings’
in “/config/packages/google_home_resume.yaml”, line 1069, column 16

I suppose it is related to the new rows you added

voice_settings: &voice_settings
        check_for_title: "Witte ruis"
        use_resume: true

Yep, you should add those at the top as well, as described in the update instructions.

Including “Witte ruis”?

Doesn’t really matter what you put there, as long as the first line (voice_settings: &voice_settings) is in.

Unfortunately, it didn’t work.
In the traces I see 4 things now. THe google home event and voice didn’t execute, while the other two yes.

google - Pastebin.com
helper - Pastebin.com

Did you actually read what was changed in this 2022.12? These two scripts were added to the package. They won’t be used for resume, they can be used for other purposes. If you are interested in what they can do, please have a look at the links.

The trace of the main script is cut off after line 72
The helper script looks fine, according to it is has set the volume back to 0.3 and used spotcast to reume the milena_dacheva account on media_player.ufficio_milena

Both scripts are stopped and finished
If there were more speakers playing, I need a complete trace for the main script, and the other traces of the helper scripts.

Here in the office, I have only one google device.
I will start another tts message and I will send you the complete traces

google - Pastebin.com
google help - Pastebin.com

Here the traces, it didn’t resume again. Anyway, it does as before: Imgur: The magic of the Internet
It does turn off, but it remains in idle.

"error": "Failed to get device id from Spotify",

Did you make the changes to spotcast on this HA server as well?
Anyway, there is nothing I can do here, this has to be solved by either Google, Spotify or Spotcast.
The script does what it should do, use the spocast.start service to restart Spotify. This is out of my span of control.

Yes, I checked now, and I found the changes I made.

Anyway, sometimes ago I told you that it worked after you made some changed. Is it possible if you give me that old code? I am not sure, but After I update with the new versions and it stopped to work.

You mean this post?

That was the change I was referring to in my previous post. Did you do that on both HA servers? Do note that if you update spotcast from HACS, these manual changes will be overwritten.

I found this:

Probably the version before my comment

The other thing that I remember that it worked after you told me to make the modification for spotcast config files.

You lost me.

The changes to spotcast are linked in the post above yours.
Nothing has changed in the way the script should be called.

Update

Version 2022.12.1

:star2: Improvements

  • (2022.12.1) New setting: max_runtime has been added. Here you can define a time period after which the scripts should be stopped, to avoid them waiting for ages. Take into account that this has to be longer than the interruption, so if you play a song of 10 minutes, the max_runtime has to be set longer than that

  • (2022.12.1) The spotcast.start service call is now issued twice, this should help in resuming Spotify

Using the spotcast.start service call twice (in combination with the changes in the spotcast files) seems to be working for me.

Can you give version 2022.12.1 a try?

I tried two times. The first time after executing the script it turned off directly the device after, the second time, it goes in idle.
The strange thing that I noticed it was that I try to start a music using Milena’s Spotify account, but when it started to play, it used my account. I do not know, if this “wrong” way of working could be the cause to do not work the resume.

Imgur

You don’t have to do anything two times, I’ve done that in the script.

Did you already update to 2022.12.1?
Please do that, and then do another test

You didn’t understand me. I told you that I send two tts separately, to make a couple of tests.
And yes, I have made this test after doing the update.

I will made further test at home to the other ha server, and I let you know.

If;

  • You updated the script to 2022.12.1
  • You canged the spotcast files
  • The scripts are finished without error

Then I’m afraid there is not much more I can do on my end.

If in you case it works, I cannot understand why in my case it should not work.
And I have two separate home assistant servers, so at least at one it should work.

The other thing that I would like to try later, if all the tests will fail, to let me know which is the part of the code of the script which is responsible for resuming and to try to execute it from the developer mode after executing the script…I will try to call it as a service separately and after executing the google resume script to see if it will work.