# \[HOW-TO\]\[Pro\]\[Cloud\] - Tool to FIX (advanced) flows after removing and re-adding devices

**URL:** https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018
**Category:** Tutorials
**Tags:** zigbee, flow, homey-pro, homey-bridge, howto
**Created:** [June 23, 2022, 12:20pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018 "2022-06-23T12:20:57Z")
**Posts on this page:** 20
**Page:** 1

<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: [June 23, 2022, 12:20pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/1 "2022-06-23T12:20:57Z")

</div>

ℹ Also available as app: [[APP][Pro]Flow Converter](https://community.homey.app/t/app-pro-flow-converter/154906)

> 🚨⚠ **Use at own risk!** ⚠ 🚨

If you have a broken device which you want to replace or you have to fix flows for your device  
I made a script which can help with this.

**Instructions:**

1. Device ID you would like to update -

```js
- Go to the Homey web app 
- Devices 
- Right click on the device to show context menu
- Hold down Alt / option key on keyboard 
- Select “Copy ID”.

```

1. Write down the Device ID
2. Remove the Device
3. Re-add the Device
4. Get the Device ID of the new paired device:

```js
- Go to the Homey web app 
- Devices 
- Right click on the device to show context menu
- Hold down Alt / option key on keyboard 
- Select “Copy ID”.

```

1. Run this script in the **[WebAPI playground](https://tools.developer.homey.app/tools/api-playground)**: (multiple devices possible)

> - [**script based on ID**](https://gist.github.com/martijnpoppen/dcf0b8fd3f7fe63dec087c87dbc66090#file-fix-flows-by-id-js): **Recommended**
> - [**scripts based on device Name**](https://gist.github.com/martijnpoppen/dcf0b8fd3f7fe63dec087c87dbc66090#file-fix-flows-by-name-js) (Make sure to use unique device names!)

* * *

**Contributions**  
If you appreciate what I do, contribute to future development by making a [paypal contribution](https://www.paypal.me/martijnpoppen)  
or buy me a coffee on [Ko-Fi](https://ko-fi.com/martijnpoppen#checkoutModal) or [Bunq.me](https://bunq.me/MartijnPoppen)

[![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/9/2916364caa1239076c12be293d270d5980d9d272.png)](https://paypal.me/martijnpoppen) [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/martijnpoppen#checkoutModal)[![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/4/8449771d527e7184562e1301d641dfc1e99a4261.png)](https://bunq.me/MartijnPoppen)

* * *

## 💻 Apps made by @martijnpoppen

See for more apps link below 👇🏻 or just open the pull down.

> [@Apps made by @martijnpoppen](https://community.homey.app/t/apps-made-by-martijnpoppen/85812/1):
>
> Click to expand

---

<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: [June 26, 2022, 3:49am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/2 "2022-06-26T03:49:48Z")

</div>

Maestro, 🙏🙏🙏

Congrats with your new Home(y).

My P1 dongle did not respond anymore. In short, only option was to remove and re-add it. That’s a PITA when lots of flows are involved.  
BUT, your brilliant script saved the day, Martijn.

I saved the dongle’s ID and removed it.  
(To me, the device ID is easily / easier found by using the [devices search](https://tools.developer.homey.app/tools/devices) function.)  
After re-adding the dongle, I searched for its new ID and I updated old & new ID’s in your script, and ran it.

✅🎉 **it did the trick! 20 flows got fixed!**

Note: The flows with broken variables did not fix themselves, so maybe here’s is a new challenge 😬 (Warning: it does not have to be fixed today, or tomorrow 🙃🤪)

Oh, a suggestion to the topic subject:  
_[HOW-TO][Pro][Cloud] - Tool to FIX flows after removing and re-adding devices_  
And it’s not limited to zigbee devices btw.

All the best,  
Peter

---

<div class="post-metadata">

### Author: ![Mike1233](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mike1233/32/20991_2.png) [@Mike1233](https://community.homey.app/u/Mike1233)
#### Post date: [June 26, 2022, 10:04am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/3 "2022-06-26T10:04:56Z")

</div>

If this works with remove and re-ad the device this also can work with a compleet new device?  
Like a broken Aqara temperature or doorsensor and you change it for the same type of device.  
Use this script and you’re ready again.

---

<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: [June 26, 2022, 10:14am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/4 "2022-06-26T10:14:57Z")

</div>

@Mike1233 yes it does, as long as the devices are using the same flowcards

---

<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: [June 28, 2022, 4:30pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/5 "2022-06-28T16:30:07Z")

</div>

Hi Martijn,

Is it possible to run it with HomeyScript?  
(Well, I tried but nothing changes hehe).  
I just don’t understand why the web api playground and HS can’t run the same scripts 😬🤓

---

<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: [June 28, 2022, 4:43pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/6 "2022-06-28T16:43:31Z")

</div>

Depends on the access roles. Web API has more rights

---

<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: [July 6, 2022, 10:54am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/7 "2022-07-06T10:54:50Z")

</div>

Added advanced flows support 🙂

---

<div class="post-metadata">

### Author: ![timvdhoorn](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/timvdhoorn/32/55746_2.png) [@timvdhoorn](https://community.homey.app/u/timvdhoorn)
#### Post date: [July 7, 2022, 1:16pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/8 "2022-07-07T13:16:33Z")

</div>

This is great! Thanks a lot!

---

<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: [July 8, 2022, 1:27am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/9 "2022-07-08T01:27:55Z")

</div>

> [@martijnpoppen](#):
>
> (multiple devices possible)

Hi Martijn,  
If I want to fix multiple devices at once, is this the correct way to enter the ID’s?

```auto
const oldIds = ['e63c7964-2e67-4347-b2e0-d17a9e4df7e9',
'e63c7964-2e67-4347-b2e0-d17a9e4df7e8',
'e63c7964-2e67-4347-b2e0-d17a9e4df7e7'
];

```

---

<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: [July 8, 2022, 7:15am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/10 "2022-07-08T07:15:42Z")

</div>

@Peter_Kawa yes that’s correct.

Make sure that the first ID of the old array is the same device as the first ID of the new array 😉

---

<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: [July 8, 2022, 11:40am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/11 "2022-07-08T11:40:23Z")

</div>

🤙that makes perfectly sense, Martijn. Thanks.

---

<div class="post-metadata">

### Author: ![Manni\_A](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/manni_a/32/13549_2.png) [@Manni\_A](https://community.homey.app/u/Manni_A)
#### Post date: [July 8, 2022, 12:37pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/12 "2022-07-08T12:37:08Z")

</div>

Great Tool!! Thanks a lot !!

---

<div class="post-metadata">

### Author: ![Arjan-21](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/arjan-21/32/27181_2.png) [@Arjan-21](https://community.homey.app/u/Arjan-21)
#### Post date: [August 4, 2022, 2:57pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/13 "2022-08-04T14:57:49Z")

</div>

Really nice Martijn!  
Saved me allot of time today!

---

<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: [August 4, 2022, 3:42pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/14 "2022-08-04T15:42:09Z")

</div>

Thanks,!!!

---

<div class="post-metadata">

### Author: ![Mike1233](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mike1233/32/20991_2.png) [@Mike1233](https://community.homey.app/u/Mike1233)
#### Post date: [August 10, 2022, 1:58pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/15 "2022-08-10T13:58:20Z")

</div>

Did buy you a beer.  
Removed and re-added 2 Shelly devices.  
Great app.  
Saves a lot of time.

---

<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: [August 10, 2022, 2:02pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/16 "2022-08-10T14:02:54Z")

</div>

Thanks a lot man!

---

<div class="post-metadata">

### Author: ![Mike1233](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mike1233/32/20991_2.png) [@Mike1233](https://community.homey.app/u/Mike1233)
#### Post date: [August 27, 2022, 5:41pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/17 "2022-08-27T17:41:22Z")

</div>

@martijnpoppen  
I have used this script a couple of times now and it works good.  
But is it possible with a script to get a output of the devices and the ID?  
So you can make a sort of backup of the devices.  
Instead of a copy/paste of the device list.  
When there is something wrong, remove the device directly without first find  
out what ID it is.

Somethink like this:

Device Voordeur  
ID llfuflulyf415125luyffl145

Achterdeur  
ID 05005o86trygfuoylo68e

Schemerlamp  
ID 05efh65ljhljh1654lj6jfdg

Thank you.  
I hope i can ask it here.

---

<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: [August 27, 2022, 6:04pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/18 "2022-08-27T18:04:50Z")

</div>

@Mike1233 thanks!

I think @Peter_Kawa has posted such a script somewhere on the forum here…

---

<div class="post-metadata">

### Author: ![Mike1233](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mike1233/32/20991_2.png) [@Mike1233](https://community.homey.app/u/Mike1233)
#### Post date: [August 27, 2022, 6:06pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/19 "2022-08-27T18:06:19Z")

</div>

@martijnpoppen  
Thank you.  
I wil have a look at the posts of @Peter_Kawa

---

<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: [August 27, 2022, 9:11pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/20 "2022-08-27T21:11:52Z")

</div>

Hi Mike,

Here’s a nice one (don’t know if I posted it), and it fits in this topic I think.  
With this _HomeyScript_ script you’ll have a nice device ID overview to save somewhere safe😉  
(You can remove values you don’t need)  
Note: a **`** is not equal to **’**

```auto
const devices = await Homey.devices.getDevices();
console.log(`\nDevices overview`);
// Loop over all devices
for (const device of Object.values(devices)) {  
    // Return some properties. Just remove what you don't need
    console.log(`\nName:\t\t ${device.name} \nID:\t\t ${device.id} \nZone:\t\t ${device.zoneName} \nApp:\t\t ${device.driverUri} \nDriverID:\t ${device.driverId} \nCapabilities:\t ${device.capabilities} \nClass:\t\t ${device.class} \nVirtualClass\t (what's plugged in): ${device.virtualClass}`);
};
return(true);

```

Output example of 1 device

> ![Screenshot_20220827-230517_Chrome](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/7/a72f8b6e3eee065f49f116b73f46f50044340586.jpeg)

.  
Oh, and, 'VirtualClass is used with smart sockets.  
With such devices you can pick class ‘Light’ f.i., so the socket responds to “Turn off all lights” commands

[Next page](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018.md?page=2)
