# Restart an app

**URL:** <https://community.homey.app/t/restart-an-app/52319>\
**Category:** Developers\
**Created:** [September 27, 2021, 10:53pm UTC](https://community.homey.app/t/restart-an-app/52319 "2021-09-27T22:53:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Le\_Cactus](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/le_cactus/32/9727_2.png) [@Le\_Cactus](https://community.homey.app/u/Le_Cactus)\
**Post date:** [September 27, 2021, 10:53pm UTC](https://community.homey.app/t/restart-an-app/52319/1 "2021-09-27T22:53:43Z")

</div>

Is there a way to let an app restart itself? Or is the webapi able to restart an app?  
I know flows can restart an app, but that is not what I’m looking for at this point 🙂

---

<div class="post-metadata">

**Author:** ![Hugo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/hugo/32/11530_2.png) [@Hugo](https://community.homey.app/u/Hugo)\
**Post date:** [September 28, 2021, 5:06am UTC](https://community.homey.app/t/restart-an-app/52319/2 "2021-09-28T05:06:09Z")

</div>

Homey needs a trigger to do anything.  
So maybe you can use the reason why it should restart.  
But restart because of a not working app mostly does not work on my Homey.

---

<div class="post-metadata">

**Author:** ![Shakesbeard](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/shakesbeard/32/15112_2.png) [@Shakesbeard](https://community.homey.app/u/Shakesbeard)\
**Post date:** [September 28, 2021, 5:11am UTC](https://community.homey.app/t/restart-an-app/52319/3 "2021-09-28T05:11:26Z")

</div>

The app stopped working event only works if the app crashed. It is not triggered if the app was paused due to exzessive cpu or ram usage.

---

<div class="post-metadata">

**Author:** ![martijnpoppen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijnpoppen/32/84849_2.png) [@martijnpoppen](https://community.homey.app/u/martijnpoppen)\
**Post date:** [September 28, 2021, 9:55am UTC](https://community.homey.app/t/restart-an-app/52319/4 "2021-09-28T09:55:25Z")

</div>

@Le_Cactus as far as I know it’s not possible to restart the app. Also not via the webAPI.  
Why do you want to restart the app automatically?

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [September 28, 2021, 9:57am UTC](https://community.homey.app/t/restart-an-app/52319/5 "2021-09-28T09:57:31Z")

</div>

> [@martijnpoppen](#):
>
> Also not via the webAPI.

> **[ManagerApps - Homey Web API](https://athombv.github.io/node-homey-api/HomeyAPIV2.ManagerApps.html#restartApp)**

---

<div class="post-metadata">

**Author:** ![martijnpoppen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijnpoppen/32/84849_2.png) [@martijnpoppen](https://community.homey.app/u/martijnpoppen)\
**Post date:** [September 28, 2021, 9:58am UTC](https://community.homey.app/t/restart-an-app/52319/6 "2021-09-28T09:58:55Z")

</div>

@robertklep Oh nice!  
Also thanks for sharing that link. Couldn’t find the webapi docs 🤦‍♂️

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [September 28, 2021, 10:00am UTC](https://community.homey.app/t/restart-an-app/52319/7 "2021-09-28T10:00:42Z")

</div>

Sadly though, it’s not possible to use HomeyScript to restart an app due to insufficient permissions ☹

---

<div class="post-metadata">

**Author:** ![Le\_Cactus](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/le_cactus/32/9727_2.png) [@Le\_Cactus](https://community.homey.app/u/Le_Cactus)\
**Post date:** [September 28, 2021, 10:32am UTC](https://community.homey.app/t/restart-an-app/52319/8 "2021-09-28T10:32:16Z")

</div>

Because I need an async function to fetch a token, but I don’t know how to update the token after credentials have changed.

```auto
this.homey.settings.on('set', args => {
	credentials = this.homey.settings.get('credentials')
	token = await some-async-function(credentials)
}

```

This gives me an “await is only valid in async function” error and I don’t know how to some it. Restarting the app would just be a quick workaround.

(I’m just a hobbyist 😊)

---

<div class="post-metadata">

**Author:** ![martijnpoppen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijnpoppen/32/84849_2.png) [@martijnpoppen](https://community.homey.app/u/martijnpoppen)\
**Post date:** [September 28, 2021, 10:54am UTC](https://community.homey.app/t/restart-an-app/52319/10 "2021-09-28T10:54:19Z")

</div>

I think it should work like this:

```auto
this.homey.settings.on('set', async args => {
	credentials = this.homey.settings.get('credentials')
	token = await some-async-function(credentials)
}

```

---

<div class="post-metadata">

**Author:** ![Le\_Cactus](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/le_cactus/32/9727_2.png) [@Le\_Cactus](https://community.homey.app/u/Le_Cactus)\
**Post date:** [September 28, 2021, 1:38pm UTC](https://community.homey.app/t/restart-an-app/52319/11 "2021-09-28T13:38:47Z")

</div>

Thanks. How can I have missed that… 😫
