# Script to restart Google Chromecast

**URL:** <https://community.homey.app/t/script-to-restart-google-chromecast/80919>\
**Category:** Apps\
**Tags:** homeyscript\
**Created:** [May 22, 2023, 8:50am UTC](https://community.homey.app/t/script-to-restart-google-chromecast/80919 "2023-05-22T08:50:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kim\_Steffen\_Johnsen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kim_steffen_johnsen/32/56749_2.png) [@Kim\_Steffen\_Johnsen](https://community.homey.app/u/Kim_Steffen_Johnsen)\
**Post date:** [May 22, 2023, 8:50am UTC](https://community.homey.app/t/script-to-restart-google-chromecast/80919/1 "2023-05-22T08:50:01Z")

</div>

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:

```auto
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:  
❌ Script Error  
⚠ 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)

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [May 22, 2023, 12:35pm UTC](https://community.homey.app/t/script-to-restart-google-chromecast/80919/2 "2023-05-22T12:35:45Z")

</div>

The right app id can be found [here](https://tools.developer.homey.app/tools/devices) (enter an app’s device name)

 ![Screenshot_20230522-142558_Chrome](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/e/1e938461021e971911edee2dd91f3121043f5760.jpeg)

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)

 ![Screenshot_20230522-141917_Firefox](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/a/0aff17b577a8a2a760275663faaa4a56243e0e6c.jpeg)

 ![Screenshot_20230522-141952_Firefox](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/8/8841a6ab637a32a5c47cc2a423a3f5f01992d00a.jpeg)

 ![Screenshot_20230522-142045_Firefox](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/2/822e39c435e44b622aa26957146f2d7a7f0dd7b4.jpeg)

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

---

<div class="post-metadata">

**Author:** ![Arie\_J\_Godschalk](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arie_j_godschalk/32/63027_2.png) [@Arie\_J\_Godschalk](https://community.homey.app/u/Arie_J_Godschalk)\
**Post date:** [May 22, 2023, 1:20pm UTC](https://community.homey.app/t/script-to-restart-google-chromecast/80919/3 "2023-05-22T13:20:59Z")

</div>

Indeed, remove the @2.0.0 part.

---

<div class="post-metadata">

**Author:** ![Rudi\_Hendrix](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rudi_hendrix/32/31931_2.png) [@Rudi\_Hendrix](https://community.homey.app/u/Rudi_Hendrix)\
**Post date:** [January 13, 2024, 8:17pm UTC](https://community.homey.app/t/script-to-restart-google-chromecast/80919/4 "2024-01-13T20:17:15Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Lipas](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/lipas/32/72447_2.png) [@Lipas](https://community.homey.app/u/Lipas)\
**Post date:** [January 26, 2024, 2:15pm UTC](https://community.homey.app/t/script-to-restart-google-chromecast/80919/5 "2024-01-26T14:15:07Z")

</div>

Hi Rudi,  
any progress with your case?

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [January 26, 2024, 11:15pm UTC](https://community.homey.app/t/script-to-restart-google-chromecast/80919/6 "2024-01-26T23:15:36Z")

</div>

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

> [@Peter\_Kawa](#):
>
> ![Screenshot_20230522-141917_Firefox](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/a/0aff17b577a8a2a760275663faaa4a56243e0e6c.jpeg)

---

<div class="post-metadata">

**Author:** ![Rudi\_Hendrix](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rudi_hendrix/32/31931_2.png) [@Rudi\_Hendrix](https://community.homey.app/u/Rudi_Hendrix)\
**Post date:** [January 27, 2024, 2:43pm UTC](https://community.homey.app/t/script-to-restart-google-chromecast/80919/7 "2024-01-27T14:43:43Z")

</div>

> [@Lipas](#):
>
> Hi Rudi,  
> any progress with your case?

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