Use at own risk!
![:rotating_light: :rotating_light:](https://emoji.discourse-cdn.com/twitter/rotating_light.png?v=12)
Hi,
So I just go a new house and wanted to make my Zigbee network a bit better by removing an re-adding my devices so I get a stable network.
But the issue with this is you have to fix all your flows. (Ofcourse Flow Checker App for Homey | Homey can indicate the broken flows)
I made a small script which can help with fixing the flows.
So what do you need:
- Device ID you would like to update - You can get this via the webAPI playground:
const searchname = "devicenamehere";
Homey.devices.getDevices().then(devices => Object.values(devices).filter(device => device.name.toLowerCase().includes(searchname.toLowerCase())).map(device => ({ id: device.id, name: device.name })));
- Write down the Device ID
- Remove the Device
- Re-add the Device
- Get the Device ID of the new paired device: - You can get this via the webAPI playground:
const searchname = "devicenamehere";
Homey.devices.getDevices().then(devices => Object.values(devices).filter(device => device.name.toLowerCase().includes(searchname.toLowerCase())).map(device => ({ id: device.id, name: device.name })));
- Run this script in the WebAPI playground: (multiple devices possible)
Contributions
If you appreciate what I do, contribute to future development by making a paypal contribution
or buy me a coffee on Ko-Fi or Bunq.me
![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)
![image](https://global.discourse-cdn.com/business4/uploads/athom/original/3X/8/4/8449771d527e7184562e1301d641dfc1e99a4261.png)
See for more apps link below
or just open the pull down.
36 Likes
Maestro, ![:pray: :pray:](https://emoji.discourse-cdn.com/twitter/pray.png?v=12)
![:pray: :pray:](https://emoji.discourse-cdn.com/twitter/pray.png?v=12)
![:pray: :pray:](https://emoji.discourse-cdn.com/twitter/pray.png?v=12)
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 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.
![:white_check_mark: :white_check_mark:](https://emoji.discourse-cdn.com/twitter/white_check_mark.png?v=12)
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 ![:upside_down_face: :upside_down_face:](https://emoji.discourse-cdn.com/twitter/upside_down_face.png?v=12)
)
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
1 Like
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.
1 Like
@Mike1233 yes it does, as long as the devices are using the same flowcards
2 Likes
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 ![:grimacing: :grimacing:](https://emoji.discourse-cdn.com/twitter/grimacing.png?v=12)
![:nerd_face: :nerd_face:](https://emoji.discourse-cdn.com/twitter/nerd_face.png?v=12)
1 Like
Depends on the access roles. Web API has more rights
1 Like
Added advanced flows support ![:slight_smile: :slight_smile:](https://emoji.discourse-cdn.com/twitter/slight_smile.png?v=12)
3 Likes
This is great! Thanks a lot!
1 Like
Hi Martijn,
If I want to fix multiple devices at once, is this the correct way to enter the IDâs?
const oldIds = ['e63c7964-2e67-4347-b2e0-d17a9e4df7e9',
'e63c7964-2e67-4347-b2e0-d17a9e4df7e8',
'e63c7964-2e67-4347-b2e0-d17a9e4df7e7'
];
@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 ![:wink: :wink:](https://emoji.discourse-cdn.com/twitter/wink.png?v=12)
that makes perfectly sense, Martijn. Thanks.
Great Tool!! Thanks a lot !!
1 Like
Really nice Martijn!
Saved me allot of time today!
1 Like
Did buy you a beer.
Removed and re-added 2 Shelly devices.
Great app.
Saves a lot of time.
1 Like
@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.
@Mike1233 thanks!
I think @Peter_Kawa has posted such a script somewhere on the forum hereâŚ
2 Likes
@martijnpoppen
Thank you.
I wil have a look at the posts of @Peter_Kawa
1 Like
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 â
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
.
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
2 Likes