# \[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:** 11

<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:** [March 10, 2025, 8:32pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/204 "2025-03-10T20:32:33Z")

</div>

If you want to replace the old device with an other (new) device, it’s the same procedure:  
“Say we have a light bulb connected to homey but it doesn’t work anymore. So first we are going to get the device ID of this device. Then we remove the device from Homey. Flows will be broken after that.  
Now we’re going to add _ **a new light bulb** _ back to Homey (via the normal add device option in the app) and once it’s added we write down the id of this device.”

---

<div class="post-metadata">

**Author:** ![Ringler](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ringler/32/32563_2.png) [@Ringler](https://community.homey.app/u/Ringler)\
**Post date:** [March 10, 2025, 9:00pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/205 "2025-03-10T21:00:37Z")

</div>

Ok. Thanks a lot for this clarification. The way you write makes sense to me. For me bullet point 4 was unclear as it says re-add the device after I have removed it. So bullet point 4 is actually adding the new device.

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

I will try it out. Thanks a lot again for all your help.

Update: I have tried it and it did not work. No idea, what I do wrong, but following the 5 steps, deleting the old one, adding the new and copying the script to the “Web API Playground” in the Dev Environment (adding there the two device IDs as described) does not work. The old device is now deleted and the flows are broken. I think this is really only something for programmers…

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [March 11, 2025, 10:12am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/206 "2025-03-11T10:12:06Z")

</div>

> [@Ringler](#):
>
> For me bullet point 4 was unclear as it says re-add the device after I have removed it. So bullet point 4 is actually adding the new device.

You do not always replace an “old” device with a newly purchased device.  
Sometimes a device that has been working for 2 years without any problems stops working after an app update or a Homey firmware update, for example.  
Even then, you can delete this “old” device after noted the device ID and add this “old” device again.

> [@Ringler](#):
>
> I have tried it and it did not work

Have you set the parameter `const softRun` from `true` to `false` in line 6 of the code? Because only then will the flows be repaired.

Initial state

```auto
// Set the softRun variable to true or false to determine whether changes should be logged or actually executed
const softRun = true; // true | false

```

After change

```auto
// Set the softRun variable to true or false to determine whether changes should be logged or actually executed
const softRun = false; // true | false

```

If `softRun` is set to `true`, the replacement of the device will be only simulated. This can be checked in the web browser console. But this is maybe a bit more for programmers.

I hope this was helpful for you.

* * *

@martijnpoppen, does the script in Developer Tools/Web Api Playground have to be executed in a specific web browser? Safari, for example, is not suitable for many similar things.

---

<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:** [March 11, 2025, 11:20am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/207 "2025-03-11T11:20:29Z")

</div>

@DirkG I would recommend Chrome or Firefox 🙂

---

<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:** [March 11, 2025, 7:30pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/208 "2025-03-11T19:30:09Z")

</div>

It now runs in Homeyscript as well, Dirk.

> [@\[HOW-TO\]\[Pro\]\[Cloud\] - Tool to FIX (advanced) flows after removing and re-adding devices](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/190):
>
> Problem determined, was not using true and false in the right way within Playground. Now both Playground and Homeyscript are working. Thanks for all effort, sorry for my questions, this was all new for me!

---

<div class="post-metadata">

**Author:** ![Glenn\_Dijkstra](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/glenn_dijkstra/32/17251_2.png) [@Glenn\_Dijkstra](https://community.homey.app/u/Glenn_Dijkstra)\
**Post date:** [April 11, 2025, 8:24pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/209 "2025-04-11T20:24:34Z")

</div>

Hi,

Im totally new to scripts, but as i have a whatsapp devices with alot of cards i need to repair, i need to dive into it a littlebit.

I copied [this](https://gist.githubusercontent.com/martijnpoppen/dcf0b8fd3f7fe63dec087c87dbc66090/raw/64afd62416f4cf59c07026c166fa42ece5f336ac/fix-flows-by-id.js) full script to \</\> Web API Playground and entered the old device ID and the new one. Ran it and it shows succesfull but… the flows are not restored. Any idea what i’m doing wrong?

 ![afbeelding](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/e/0e1c52e054a07991b682c8f18d5182f503d17f3b.jpeg)  
This is the old device ID:  
 ![afbeelding](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/b/7b769411499b7b11aad519c45e8881b62322fed9.png)  
This is the new device ID:  
 ![afbeelding](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/4/24d219f86675f644d106221fc130634aa6b1af6b.png)

Did i do something wrong or did i forget a part?

Btw, I ll buy you a beer if it succeeds 😊

---

<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:** [April 11, 2025, 9:45pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/210 "2025-04-11T21:45:45Z")

</div>

Hi Glenn!

Softrun only outputs the “what would get changed” info.  
If set to false, it’ll adjust your flows for real:

 ![1000046258](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/c/ecd6f2a735ae84c9fd006356d8c7385ebf6506a0.jpeg)

Oh, and you can run it as Homeyscript nowadays 😉

---

<div class="post-metadata">

**Author:** ![Glenn\_Dijkstra](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/glenn_dijkstra/32/17251_2.png) [@Glenn\_Dijkstra](https://community.homey.app/u/Glenn_Dijkstra)\
**Post date:** [April 12, 2025, 5:32am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/211 "2025-04-12T05:32:33Z")

</div>

Thanks! Will try that! Btw, I don’t understand homey script either, so I think I should just stick to what I understand now 😂

Edit: all works, thanks alot. U’ve got ur beer 🙂

---

<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:** [April 12, 2025, 12:37pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/212 "2025-04-12T12:37:59Z")

</div>

I don’t see any beers 🤪😅

---

<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:** [April 13, 2025, 2:53pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/213 "2025-04-13T14:53:44Z")

</div>

@Glenn_Dijkstra thanks a lot!!!

---

<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:** [April 27, 2025, 7:19am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/214 "2025-04-27T07:19:44Z")

</div>

Just tried using this… Unfortunately my advanced flow is still showing all “This card is unavailable” cards ☹

I still have the old ID and new ID. What am I doing wrong?

---

<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:** [April 27, 2025, 7:20am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/215 "2025-04-27T07:20:20Z")

</div>

@Rudi_Hendrix did you change the soft run to false ?

---

<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:** [April 27, 2025, 7:23am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/216 "2025-04-27T07:23:19Z")

</div>

Ahum… Didn’t expect to get response this fast! 🙂 So, I thought I’d first post here and next have a better look.

Setting soft run to false does work. (Of course)

Thanks!

---

<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:** [April 27, 2025, 4:41pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/217 "2025-04-27T16:41:52Z")

</div>

Martijn usually already replied before you finished your sentence 😅👏

---

<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:** [April 27, 2025, 4:56pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/218 "2025-04-27T16:56:50Z")

</div>

Yeah that’s really great! Homey for sure is the best home automation platform. For a huge part thanks to the community. Let’s hope Tuya will understand that at some point too and it’s unbeatable!

---

<div class="post-metadata">

**Author:** ![Kristina\_Bertilsson](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kristina_bertilsson/32/58940_2.png) [@Kristina\_Bertilsson](https://community.homey.app/u/Kristina_Bertilsson)\
**Post date:** [May 19, 2025, 11:38am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/219 "2025-05-19T11:38:03Z")

</div>

This sounds like something I could use! just want to confirm! My Homey 2019 is acting strange, many of the Zigbee devices are behaving wierd, they are working sometimes, but not always and I cannot add new devices. I have tried a lot of things but nothing has worked, so I am considering a reset of the zigbee network and re-adding all devices. Could I use this script to fix all the flows? Does it work for Early 2019.

---

<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:** [May 19, 2025, 11:42am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/220 "2025-05-19T11:42:47Z")

</div>

@Kristina_Bertilsson short answer. But yes it does!  
But make sure to write all your ids down before you reset

---

<div class="post-metadata">

**Author:** ![Kristina\_Bertilsson](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kristina_bertilsson/32/58940_2.png) [@Kristina\_Bertilsson](https://community.homey.app/u/Kristina_Bertilsson)\
**Post date:** [May 19, 2025, 12:02pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/221 "2025-05-19T12:02:56Z")

</div>

Thanks! Makes it a lot easier than correcting all flows manually!

---

<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:** [May 19, 2025, 8:45pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/222 "2025-05-19T20:45:05Z")

</div>

I did get this script from @Peter_Kawa to get al the ID’s

Tried to copy the script, does not work. So i made a screenshot, sorry.

 ![1000000480](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/b/3b1b5ba40077d080f74c0128c03de1ffd6bb31bb.jpeg)

---

<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 19, 2025, 11:40pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/223 "2025-05-19T23:40:38Z")

</div>

@Mike1233 @Kristina_Bertilsson  
This works on my Pro 2019, and it can search for a specific device:

```auto
// To find a devices' ID

// Change 'my_device_name' into device name you want to find the ID of
const deviceName = "my_device_name";
// End of user input

const devices = await Homey.devices.getDevices();
log(`\nDevices overview`);

for (const device of Object.values(devices)) {  
  if (device.name === deviceName) {
    // Return some properties. Just remove what you don't need
    log(`\nName:\t\t ${device.name} \nID:\t\t ${device.id} \nDriver:\t\t ${device.driverId} \nCapabilities:\t ${device.capabilities}`);
  }
};
return(true);

```

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

[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=12)
