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

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

</div>

@Peter_Kawa Thank you for sharing this.  
I will give it a try.

---

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

</div>

For just device + ID overview use this code in HomeyScript:

```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} `);
};
return(true);

```

---

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

</div>

Tank you.

But when i try it in Homey at the Developers Tools i get this error.

##### Response

“root”:{

1 item

“error”:

string"await is only valid in async functions and the top level bodies of modules"

}

Or is this schript for the Homey app.

---

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

</div>

Oh, my bad it wasn’t clear: this is Homeyscript.  
Create a new script  
(@ my.homey.app hit the `</> `icon on the left, look for `+ New Homeyscript ` below all other scripts)  
copy/paste the code,  
save and run.

---

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

</div>

@Peter_Kawa  
Thank you.  
It works good.

---

<div class="post-metadata">

**Author:** ![K\_S](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/k_s/32/11635_2.png) [@K\_S](https://community.homey.app/u/K_S)\
**Post date:** [August 28, 2022, 1:56pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/26 "2022-08-28T13:56:37Z")

</div>

Thanks @martijnpoppen - I don’t know why that isn’t a native function that is built into the Homey UI

---

<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 28, 2022, 10:15pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/27 "2022-08-28T22:15:39Z")

</div>

You’re welcome @K_S !

---

<div class="post-metadata">

**Author:** ![Martijn\_de\_Bokx](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijn_de_bokx/32/4488_2.png) [@Martijn\_de\_Bokx](https://community.homey.app/u/Martijn_de_Bokx)\
**Post date:** [September 5, 2022, 5:35pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/28 "2022-09-05T17:35:43Z")

</div>

Wow this scripts is great! Should be applied basic to homey i think 🙂

Thanks for making this!

---

<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 5, 2022, 5:44pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/29 "2022-09-05T17:44:11Z")

</div>

Thanks Martijn!

---

<div class="post-metadata">

**Author:** ![Henk\_Renting](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/henk_renting/32/87634_2.png) [@Henk\_Renting](https://community.homey.app/u/Henk_Renting)\
**Post date:** [September 15, 2022, 3:05pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/30 "2022-09-15T15:05:40Z")

</div>

Today I re-added my Shelly devices using the new generic driver. Something that had to be done sooner or later. Thanks to your script, repairing my flows cost me so much less time.  
Thanks, @martijnpoppen, enjoy the beer I bought you!

---

<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 15, 2022, 3:58pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/31 "2022-09-15T15:58:05Z")

</div>

Thank you so much @Henk_Renting !

---

<div class="post-metadata">

**Author:** ![M\_a\_r\_c\_o](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/m_a_r_c_o/32/146_2.png) [@M\_a\_r\_c\_o](https://community.homey.app/u/M_a_r_c_o)\
**Post date:** [September 24, 2022, 9:44am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/32 "2022-09-24T09:44:41Z")

</div>

> [@martijnpoppen](#):
>
> > `Homey.devices.getDevices();`

Is it possible to adjust the above code that I can only search for 1 specific device name? I have so many devices (150+) that creating this list and then copy/past hangs the browser for minutes.

---

<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 24, 2022, 9:54am UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/33 "2022-09-24T09:54:24Z")

</div>

@M_a_r_c_o yeah I can add a script for that. 🙂

---

<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:** [September 24, 2022, 1:23pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/34 "2022-09-24T13:23:19Z")

</div>

Alternative

> [@Peter\_Kawa](#):
>
> To me, the device ID is easily / easier found by using the [devices search](https://tools.developer.homey.app/tools/devices) function.

---

<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 24, 2022, 1:24pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/35 "2022-09-24T13:24:00Z")

</div>

@Peter_Kawa thats a good suggestion

---

<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:** [September 24, 2022, 1:26pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/36 "2022-09-24T13:26:17Z")

</div>

I got this HomeyScript as well

```auto
// Replace MyDevice with the desired device name

let deviceName = "MyDevice"

const myDevices = await Homey.devices.getDevices()

for (var iMyDevice in myDevices){

if (myDevices[iMyDevice].name == deviceName) {

log(`Device:\t ${myDevices[iMyDevice].name} \nZone:\t ${myDevices[iMyDevice].zoneName} \nType:\t ${myDevices[iMyDevice].type} \nValue:\t ${myDevices[iMyDevice].value} \nID:\t ${myDevices[iMyDevice].id}`)

}

}

```

---

<div class="post-metadata">

**Author:** ![M\_a\_r\_c\_o](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/m_a_r_c_o/32/146_2.png) [@M\_a\_r\_c\_o](https://community.homey.app/u/M_a_r_c_o)\
**Post date:** [September 26, 2022, 7:11pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/37 "2022-09-26T19:11:32Z")

</div>

Sorry, HomeyScript I don’t use and do not want to activate it, I already are against memory limits in the Homey Pro (1GB RAM) version). Starting HomeyScript for only this, disrupt performance in my Homey.

Device search is maybe the option, but if we can replace a device id in a web dev tools script, whats the difficulty to search on device name in dev tools? (I am not a programmer, otherwise…).

---

<div class="post-metadata">

**Author:** ![M\_a\_r\_c\_o](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/m_a_r_c_o/32/146_2.png) [@M\_a\_r\_c\_o](https://community.homey.app/u/M_a_r_c_o)\
**Post date:** [September 26, 2022, 7:12pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/38 "2022-09-26T19:12:16Z")

</div>

> [@martijnpoppen](#):
>
> yeah I can add a script for that. 🙂

I have send a pm (I think) earlier.

---

<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 26, 2022, 7:29pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/39 "2022-09-26T19:29:39Z")

</div>

@M_a_r_c_o  
Yes saw the PM. I thought the suggestion for the device search was a good one. But i can still add a web api console script.  
Will do end this week 🙂

---

<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 1, 2022, 8:13pm UTC](https://community.homey.app/t/how-to-pro-cloud-tool-to-fix-advanced-flows-after-removing-and-re-adding-devices/65018/40 "2022-10-01T20:13:17Z")

</div>

@M_a_r_c_o added the script to search based on device name. Added to the first message in this topic, but will link it here too: [Fix flows by device name](https://gist.githubusercontent.com/martijnpoppen/dcf0b8fd3f7fe63dec087c87dbc66090/raw/4335dfc926ebc8db39a3ce4704739571c8d6629a/gistfile1.txt)

TIP: Make sure to use unique device names. If you have duplicate names it might brick your flows.

And many thanks for your donation! Appreciated! 🙂

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

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