Script to restart Google Chromecast

I am trying to create a script to restart the Google Chromecast app on a regular basis as it keeps disconnecting from devices. This is what I have:

const appName = 'Google ChromeCast';
const app = await Homey.apps.getApp({ name: appName });
await app.restart({ id: 'homey:app:com.google.chromecast@2.0.0' });

But I get this error:
:x: Script Error
:warning: RestartChromeCast.js:3
await app.restart({ id: homey:app:com.google.chromecast@2.0.0 });
^

SyntaxError: Unexpected token ‘:’
at new Script (node:vm:100:7)
at HomeyScriptApp.runScript (/app.js:483:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.runScript (/api.js:30:22)

The right app id can be found here (enter an app’s device name)

Or just take a look at the app store URL; the last part of the app id is the ‘reversed URL’ right after /app/

https://homey.app/en-gb/app/com.google.chromecast/Google-Chromecast/

But why not use a flow (I’m on my mobile, sorry, so ‘glue’ the screenshots from left to right)

Explained: When the app is paused or crashed, the Chromecast card will be unavailable.
In that case, the flow restarts Chromecast

1 Like

Indeed, remove the @2.0.0 part.

Can you check if a Google Home Mini is in error?

I have the same issue with two Google Home Mini devices. Found multiple topics on it, but none of them are recently updated. Does that mean the issue is fixed (for some people)? Or people have just given up on it?

Hi Rudi,
any progress with your case?

Just replace the HubHub card with a Google Mini card in the flow example I showed a few posts back

Yes, I just restart the app before I want to use it. This seems to be working just fine