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.”
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.
- Write down the Device ID
- Remove the Device
- Re-add the Device
- 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…
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.
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
// 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
// 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.
@DirkG I would recommend Chrome or Firefox ![]()
It now runs in Homeyscript as well, Dirk.
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 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?
This is the old device ID:
This is the new device ID:
Did i do something wrong or did i forget a part?
Btw, I ll buy you a beer if it succeeds ![]()
Hi Glenn!
Softrun only outputs the “what would get changed” info.
If set to false, it’ll adjust your flows for real:
Oh, and you can run it as Homeyscript nowadays ![]()
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 ![]()
I don’t see any beers ![]()
![]()
@Glenn_Dijkstra thanks a lot!!!
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?
@Rudi_Hendrix did you change the soft run to false ?
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!
Martijn usually already replied before you finished your sentence ![]()
![]()
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!
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.
@Kristina_Bertilsson short answer. But yes it does!
But make sure to write all your ids down before you reset
Thanks! Makes it a lot easier than correcting all flows manually!
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.
@Mike1233 @Kristina_Bertilsson
This works on my Pro 2019, and it can search for a specific device:
// 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);




