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

These traces don’t help me, as they are not related to the script.
They will trigger the automation, but they don’t show anything I can work on.

BTW your automation fails because you are using mode: single and it was triggered a second time while it was still completing the first run. But that has nothing to do with my script.

I need:

  • a trace of the automation (one that actually triggers the script, so use the arrows to go through them and pick the last one which doesn’t fail on the conditions).
  • a trace of the main Google Home Resume script
  • a trace of the Google Home Resume helper script which tried to resume the player which was playing Spotify

Hi guys, this project looks great!

For now, I’m only interested in storing the current volumes of all google homes in 1 group, make an announcement through tts.google_say, then restore to original volume(s)

Is there a specific service I can call within my automation for that before the tts.google_say action?

(post deleted by author)

First of all, no need to shout. I’m trying to help you here. There are lot of different people here asking for help, and there are nearly 800 posts in this topic. You can’t expect me to remember who is using the script in which way.

Your automation indeed calls the script, but that’s all it does, that doesn’t provide me any valuable information. If I need to find out why the script is not resuming, I need the traces from my script.
So please stop providing traces of your automations, I can see in the trace of the script exactly how and why it started. And the previous trace you provided was not started by your automation, it was started by my automation. An old version of my automation which caused the script to fail.

Well, now back to your latest traces. There is something wrong, but I need more information from you. The trace of the main script you provided was started by the automation, but the automation should not start the script, because you are starting it yourself (in your automation). The automation has a condition which should check if the script is already active for these entities, and if so, it should not start.
To find out why this condition fails, I need the trace of the main script which actually was triggered by your automation, this trace should show that groups are created, which then should be used by the automation.

The helper script in this case was triggered by the main script, and that run of the main script was triggered by you. I can see that on the player_data provided by the main script, it mentions "data_source": "resume_script" where in the trace of the main script you see "data_source": "automation"

The resume failed because of the spotcast integration ("error": "Could not find device with name Kitchen Display"). Unfortunately there is nothing I can do to help there, besides the advice already given earlier to change some lines in the spotcast files in the custom_components folder.

To debug what’s going wrong with my automation I would like to ask you to have a look at the traces of the main script. There are probably 2 traces available with a nearly identical timestamp. One is triggered by you, the other by the automation.

Could you send me:

  • the latest two traces of main script with a nearly identical timestamp
  • the latest trace of my automation with a timestamp matching the timestamp of the main scripts

Do note that that won’t help resuming Spotify, because that is failing on the spotcast integration.

2 Likes

(post deleted by author)

No, you are not understanding what I’m trying to tell you.

You are indeed calling the script in your automation. But the script is also called by my automation, which should not be the case.
To find out why, I need more information, information which I just asked for, and which you did not give yet.

You only sent me the latest trace of the main script, which is the one triggered by my automation, and I would like to know why that happened.

I’m not saying you’ve set it up incorrectly, I’m saying that something is wrong in how the script and my automation are working together. I’m trying to find out what that is.

But if you’d just set enable_automation: false in the settings at the top of the script, my automation will not be triggered anymore, so that might help. I won’t be able to find out why it is triggering in the first place, but that’s fine.

Again, I’m not saying you should do things differently here, the way you are calling the script is fine. That’s also why I’m saying that your automation is not relevant here. I just need more information from you why the code in my script/automation isn’t functioning as it should.

1 Like

(post deleted by author)

Keep it down, please. You’re ranting, being ad hominem and this guy made this script in his time off. Be kind.

3 Likes

People are trying their best to help you. Please respond in a polite manner, no matter how frustrated you feel.

2 Likes

I just (quickly) read back through the topic. All I see is TheFes very patiently trying to help you. No evidence of him attacking you.

TheFes is one of our most knowledgeable, helpful and courteous community members and has recently been promoted to moderator in recognition of this. It would be very out of character for them to attack someone.

Now, this is my opinion - please try not to take it the wrong way - but I think you may be feeling quite frustrated. I know form personal experience it is difficult to accomplish anything while feeling like this. Personally the best thing I find to do is to take a break and come back to it with a clear head at a later time.

I know you want this fixed but your house is not going to explode in flames if you do not solve this issue immediately. Go and do something you enjoy for a bit. The come back and have another go.

5 Likes

You are 1 response away from moderation action. Stop. You are being unreasonable, no one else.

3 Likes

Can’t believe what I’ve been reading. Can we all show some appreciation to @TheFes for this FREE script with support (that imo is better than any paid service I’ve seen). If you benefit from this script and can afford to buy a coffee in appreciation I recommend you do so.

4 Likes

Hi, did you make the changes recommended in the link @TheFes posted? I have the same issues but I’m struggling with making the changes. After I made the changes my spotify configuration seems to have gone bad (no doubt I’ve made incorrect changes).

@chicknlil25
If any posts made by me made you feel offended or attacked, I can guarantee you that was not my intention. Like I already said before, I’m only trying to help here.

You’ve claimed I’m changing the rules, but I don’t know exactly what you mean with that? Yes, there have been some major changes since last month, where I first combined the Google Home Resume script and automation in one package, and then this month I also included the two other related scripts in that package. I did this partly so it is easier for me to manage changes to the scripts. Changes in certain parts of the code can easily be used in all scripts. On the other hand it also makes it easier for new users to install it, and for existing users to update it.
The update from 2022.11 to 2022.12 did need some additional changes, and your comments made me realize I did not make that clear enough. I’m not a professional user guide writer, heck, I’m not even a professional software developer. If I was, this would not have been a script, it would have been a custom integration. But I do try to make required changes on update as clear as possible.

Since my automations no longer call your script, there’s no point sharing a trace from those. So instead you get YOUR automation, and YOUR two scripts. Audio was playing on the living room speaker only.

In none of my recent posts I have asked you to change how the script is called. The way you were calling the script is still the preferred way to use it. In all recent updates nothing was changed on how the script should, or can be called.

The thing is, that if you call the script in the automation, like you were doing, and again, which is still the preferred method, a condition in the automation should prevent it from calling the script as well. For some reason this was not working, and I was asking for your help to find out why. For this I needed more information than you were already providing, and I was merely trying to explain what I did need, and why I needed it.

Again, in none of my posts I was questioning how you were calling the script, and claiming you were doing wrong. I have tried to explain several times that there is something wrong in my automation or my script, which I want to debug.

As this did seem to have to be an unwanted approach on your side, I suggested to disable MY automation in the script settings, so at least the script would not be triggered twice (first by your automation, and then by mine). So again, I never asked from you to change the way you use the script.

I’m still willing to try to help you resolve the issues, but only if we can continue doing this in a polite way, without resolving to “shouting” and swearing.

BTW, in your last trace I do see something is off. It should have at least tried to resume the living room speaker, but for some reason it decided there was nothing to resume. So I will look into this.

2 Likes

@Jakesa @Manazer
Thanks!

Forgot @samuel81
Also thanks!

2 Likes

Yes - I did, the same changes as you (different line numbers - they fit to v3.6.27, not newer).
Anyway - it does not work, still the same errors:

Logger: homeassistant.components.script.google_home_resume_helper
Source: helpers/script.py:409
Integration: Script ([documentation](https://www.home-assistant.io/integrations/script), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+script%22))
First occurred: 16:32:27 (6 occurrences)
Last logged: 16:32:27

* 00 - Google Home Resume - Helper Script: If at step 2: Parallel action at step 1: parallel 1: Resume needed?: Resume playing: Spotify?: Error executing script. Error for repeat at pos 2: Failed to get device id from Spotify
* 00 - Google Home Resume - Helper Script: If at step 2: Parallel action at step 1: parallel 1: Resume needed?: Error executing script. Error for choose at pos 2: Failed to get device id from Spotify
* 00 - Google Home Resume - Helper Script: If at step 2: Parallel action at step 1: parallel 1: Error executing script. Error for if at pos 9: Failed to get device id from Spotify
* 00 - Google Home Resume - Helper Script: If at step 2: Error executing script. Error for parallel at pos 1: Failed to get device id from Spotify
* 00 - Google Home Resume - Helper Script: Error executing script. Error for if at pos 2: Failed to get device id from Spotify

@Manazer @Jakesa
I’ve included the 2 changed spotcast files to my repo. For me Spotify resume is still working.
I’m using spotcast 3.6.30, which should be the latest version.

Edit:
Forgot the link to the files

Thank you, your files are exactly the same as official ones (3.6.30) - no change as explained here.
So, if your Spotcast/Spotify is resuming it must be caused due to something else.

Ah, right. I totally forgot I redownloaded spotcast to revert some other changes.
I did just perform a successful resume. Will do some more tests tomorrow

I did apply the changes now. Just did a test and resume worked.
Will do some more tests tomorrow (only tested on Google Home and only the primary account)