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

<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:** [October 20, 2022, 7:12am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/62 "2022-10-20T07:12:01Z")

</div>

Updated @Sharkys 🙂

---

<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:** [October 20, 2022, 10:36am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/63 "2022-10-20T10:36:09Z")

</div>

It’s odd, while I had no problem running a softRun when Martijn added the feature, so I probably didn’t get what you were trying to tell 🤗  
But thanks for finding a bug✅

---

<div class="post-metadata">

**Author:** ![Robin\_De\_Lange](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robin_de_lange/32/25173_2.png) [@Robin\_De\_Lange](https://community.homey.app/u/Robin_De_Lange)\
**Post date:** [October 23, 2022, 7:50am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/64 "2022-10-23T07:50:11Z")

</div>

i updated 5 of mine ikea lights, and before i removed it i took both id’s. after updating and connecting to homey i tried this script. for most of my light the script work perfect. but for 2 of my light it doesnt work. the strange thing is that 2 advanced flows doesnt work and one normale flow does work.

i tried the script with the id codes and the script with the device name. both doesnt do the job.

it is also strange that when i look at the flow, the Cart not available id is the id from my button, which one you see at the left side of the picture. but that need to be an ikea light cart…

what do i wrong?

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

---

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

</div>

@Robin_De_Lange hard to say. It might be that the id’s were not correct or that the ID wasn’t found in the flow.

You can try the softrun option which is on top of the script.  
There you can see what the script will change

---

<div class="post-metadata">

**Author:** ![Robin\_De\_Lange](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robin_de_lange/32/25173_2.png) [@Robin\_De\_Lange](https://community.homey.app/u/Robin_De_Lange)\
**Post date:** [October 24, 2022, 10:48am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/66 "2022-10-24T10:48:11Z")

</div>

Thank you, I think I found the problem. I dont know why but my the button cart was switched with the light cart. maybe I didn’t write the good id on my paper the first time.

the key was to switch the button id with the new light id, so my button carts are gone now and the lights carts are back. de button carts is easier to put back in the flow again by hand 😅

---

<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:** [October 24, 2022, 11:09am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/67 "2022-10-24T11:09:27Z")

</div>

Ok thats good to know.

That’s the drawback of the script 😛  
I had it too while testing, broke 30 flows 😂

---

<div class="post-metadata">

**Author:** ![Roody](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/roody/32/57398_2.png) [@Roody](https://community.homey.app/u/Roody)\
**Post date:** [November 14, 2022, 5:42pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/68 "2022-11-14T17:42:27Z")

</div>

Is there also a way (like this script) by changing the addresses that you can pass the data from the old device to the new one (eg for the insights) otherwise you will lose your history 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:** [November 14, 2022, 5:47pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/69 "2022-11-14T17:47:10Z")

</div>

@Roody that might be possible yes 😛

I’ll have a look

---

<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:** [November 14, 2022, 7:17pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/70 "2022-11-14T19:17:14Z")

</div>

@Roody Unfortunately not possible. The insight will be removed once you remove the device 😕

---

<div class="post-metadata">

**Author:** ![Roody](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/roody/32/57398_2.png) [@Roody](https://community.homey.app/u/Roody)\
**Post date:** [November 14, 2022, 8:51pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/71 "2022-11-14T20:51:06Z")

</div>

Okay, very unfortunate, but if you have a spare device so that you can replace it before removing.

---

<div class="post-metadata">

**Author:** ![Sharkys](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sharkys/32/54029_2.png) [@Sharkys](https://community.homey.app/u/Sharkys)\
**Post date:** [March 5, 2023, 9:57pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/72 "2023-03-05T21:57:07Z")

</div>

Hi @martijnpoppen, would you have any idea why script do not work on anything like this (standard flow, THEN actions) ? It ussually works on almost anything… I wish it would be supporting also TIMER app but that probably use some else then IDs.

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/0/60fbd057b1697243014b30ea4307278428575161.png)  
As you can see, device id is “ebb…” but using it with :

> const oldIds = [‘ebb8843f-49a3-40e1-b5d5-c2e8a240d3c1’];  
> const newIds = [‘NEW\_ID’];

…it doesn’t touch that flows at all…

---

<div class="post-metadata">

**Author:** ![Dijker](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@Dijker](https://community.homey.app/u/Dijker)\
**Post date:** [March 5, 2023, 10:15pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/73 "2023-03-05T22:15:25Z")

</div>

> [@Sharkys](#):
>
> would you have any idea why script do not work on anything like this

Are you sure the New Device is the same Brand/Type/App as the Old device was?

---

<div class="post-metadata">

**Author:** ![Sharkys](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sharkys/32/54029_2.png) [@Sharkys](https://community.homey.app/u/Sharkys)\
**Post date:** [March 5, 2023, 10:24pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/74 "2023-03-05T22:24:26Z")

</div>

Hmm, it’s true it was app rewrite, so for sure the condition “app” might be not valid. I thought it will work simply based on the ID, just possibly not being functional action afterwards or partially broken. Just surprised that the script is actually not touching those at all if it’s ID based only.

---

<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 6, 2023, 8:20am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/75 "2023-03-06T08:20:03Z")

</div>

@Sharkys it actually should replace anything it can find based on those ID’s.

---

<div class="post-metadata">

**Author:** ![Sharkys](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sharkys/32/54029_2.png) [@Sharkys](https://community.homey.app/u/Sharkys)\
**Post date:** [March 6, 2023, 10:10am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/76 "2023-03-06T10:10:34Z")

</div>

Exactly, so why it keeps the old records 😉 ? It’s true that those might be the oldest I have on my Homey…  
Strange is that it always worked so far fine…

Looking on the JSON export and seems to be fine for replacement if that’s the URI part being replaced…

 ![obrazek](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/2/a2a3983ee0bf85d3cf5d570d97639fbdd67ec34b.png)

---

<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 6, 2023, 11:59am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/77 "2023-03-06T11:59:45Z")

</div>

@Sharkys when you run this script do you see any results in the console?

To open console: press Ctrl + Shift + J (or Cmd + Shift + J on a Mac).

---

<div class="post-metadata">

**Author:** ![Sharkys](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sharkys/32/54029_2.png) [@Sharkys](https://community.homey.app/u/Sharkys)\
**Post date:** [March 6, 2023, 1:40pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/78 "2023-03-06T13:40:37Z")

</div>

Thanks Martijn. Hmm, I guess I have some problem with my Homey…

One problem realized, I had enabled Rebind protection to discard upstream responses containing [RFC1918](https://datatracker.ietf.org/doc/html/rfc1918) addresses. - that actually seems to disabled Homey check if Homey is connected locally or via Cloud 🤦‍♂️

But that didn’t resolve the next :  
**softrun true**

 ![obrazek](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/1/214fa7ee212d35e525f68c3d0dbd486ccff44837.png)

**softrun false**  
(several attempts)

 ![obrazek](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/5/d58b51f4d362a4a0deac27b85cc47026b84b1d1c.png)

…rebooting Homey now.

I still don’t get why other replacements worked before/works…

Will report back if I find anything else.

---

<div class="post-metadata">

**Author:** ![Sharkys](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sharkys/32/54029_2.png) [@Sharkys](https://community.homey.app/u/Sharkys)\
**Post date:** [March 7, 2023, 5:37pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/79 "2023-03-07T17:37:14Z")

</div>

Strange…today I was fixing another flows for another devices (I (re)moved some of my Zigbee routers ;-))) )…it worked…then I came back to the device I originally tried to fix - again soft run is OK, but real run - getting errors :

 ![obrazek](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/9/291961269b48c9a26ca199139d713571ad8ff822.png)

![obrazek](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/4/84a091a9221d544dd7d5df0700b999de4460f83c.png)

Is the **/flow/flow** part right ?

`await Homey.flow.updateFlow({ id: f.id, flow: { id: f.id, actions: actions } });`

The script runs fine when commeting out actions part for updating actions cards…???

**I will probably fix it manually but still I find it interesting.**

---

<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 7, 2023, 5:56pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/80 "2023-03-07T17:56:59Z")

</div>

Will have a look!

---

<div class="post-metadata">

**Author:** ![Sharkys](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sharkys/32/54029_2.png) [@Sharkys](https://community.homey.app/u/Sharkys)\
**Post date:** [March 9, 2023, 8:27am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/81 "2023-03-09T08:27:15Z")

</div>

Martijn I know what is different when it doesn’t work. I’m actually trying to fix same device BUT from different app ! It’s for sure the reason, do you think that this could be somehow adjusted for such cases ? Might be VERY useful mainly when some devs have abandoned their apps and are even not willing to transfer - it means new app is available then but as you know, with completely different ID…so even the device type, flows, triggers etc. are the same, script doesn’t work.  
Btw I will try also based on name script, if that will not resolve the issue…  
_udpate_ so nope, even based on name it do not work.

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

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