[HOW-TO][Pro][Cloud] - Tool to FIX (advanced) flows after removing and re-adding devices

:rotating_light: :warning: Use at own risk! :warning: :rotating_light:


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 | Homey can indicate the broken flows)

I made a small script which can help with fixing the flows.

So what do you need:

  1. 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 })));
  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: - 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 })));
  1. 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

image ko-fiimage


:laptop: Apps made by @martijnpoppen

See for more apps link below :backhand_index_pointing_down:t2: or just open the pull down.

41 Likes
Aqara temp. Sensors updaten temp enz niet
Reconnect to devices?
Aqara firmware updates when connected to homey
Devices van Tradfri opnieuw aanmelden na power failures
[APP][Pro&Cloud] Shelly
How to replace a module
[APP][Pro] Powerview- Luxaflex & Hunter Douglas
[APP][Pro] Eufy Security
[APP] Qubino - Turn any home into a smart home with Qubino
[APP] Qubino - Turn any home into a smart home with Qubino
Alles opnieuw installeren
[APP] Aqara & Xiaomi Smart Home - Simplify your life with a smarter home
[APP][Pro] Misol and Ecowitt (Release 0.2.10, Test 0.2.10 )
Quickly updating firmware on IKEA devices, then readding them to Homey
Telldus Z-net Lite V2/ Migrationg to Homey Bridge/Pro
Concern of SDKv2 being deprecated
[APP][Pro] Tuya Cloud - This app allows you to connect Homey to the Tuya cloud
[APP][Pro] WhatsApp - Simple. Reliable. Private
[APP][Pro][DEPRECATED] We Connect / myAudi / MyĹ KODA / My SEAT / My Cupra
Da kommt was neues von Athom (Homey Keynote 12. Okt.)
[APP][Pro] < group > (3.2.4 - Stable)
Zigbee network zurĂźckgesetzt
[APP][Pro] SONOFF Zigbee
[APP] Aqara & Xiaomi Smart Home - Simplify your life with a smarter home
[APP][Pro] WhatsApp - Simple. Reliable. Private
Homey Developer Tool - questions
Nieuw device voor P1 poort - oude data behouden?
Melding API en driver is decrepeted
Matter Philips hue
Foutmelding bij Zigbee apparaten
Migratie Homey (Pro) (Pre-2023) naar Homey Pro (Early 2023)
How to add existing flow to a device?
[APP][Pro] Homewizard 🧙‍♂️
Hue tap dial switch long button press
[HOW-TO][Pro][Cloud] - Zigbee Route map (Homey Pro 2016 - 2019 / Homey Bridge)
Ikea Symfonisk remote for Sonos
Aqara light switch, cant connect
[APP][Pro][Cloud] P2000 for Homey (Dutch 112 (911) alerts
Accidentally reset the ZigBee network
[APP] Tuya - Connect any Tuya device with Homey (by Tuya Inc. / Athom)
[APP][Pro] AWTRIX Light - Connected Smart Clock for your Smart Home
Homey pro loses connection with all my zigbee after update
Almost all devices, scripts and flows are unavailable after Homey update
Oude flow na verwijderen apparaat zichtbaar laten
[APP][Pro] WhatsApp - Simple. Reliable. Private
Altes Gerät mit neuem Gerät in allen Flows austauschen
[APP][Pro and Cloud] Daikin ONECTA
Smart Home Start: Rollläden und Dimmer einbauen – Tipps?
Apparaat niet beschikbaar Daikin
Apparaat niet beschikbaar Daikin
Zigbee Reset tbv beter mesh netwerk
Google Chromecast App not adjusting volume
Firmware updates within Developer Tools
Transfer (Zigbee) devices to another app
[APP][Pro] WhatsApp - Simple. Reliable. Private
Add Philips Hue devices using Matter, not working
[APP][Pro] WhatsApp - Simple. Reliable. Private
Energiedaten zurĂźcksetzen
Migrating from 'Zonnepanelen' to the *SolarEdge* Enphase App, any hints?
New Sonoff wall socket, S60ZB results in: device already added
[APP][Pro] Solis Cloud Inverter - Receive realtime data from your Solis Inverter
[APP][Cloud & Pro] SwitchBot (Release 2.0.35, Test 2.0.49)
Goedkope raam - deur sensoren
Plugwise heeft geen verbinding meer na Homey update 10.0.4 (13-12-23)
ERROR_RESOURCE_GONE probleem
Tradfri lamp does not work following update Homey
Zwave of my Homey Pro Early 2023 stopped working
Keep info in card when device is missing
Z-wave IMPOSSIBLE!
Homey Pro (Early 2023) - Missing droptoken in all flows
[APP][Pro] Misol and Ecowitt (Release 0.2.10, Test 0.2.10 )
Homey bridge lost connection with Aqara switch T1 (no neutral)
Homey bridge lost connection with Aqara switch T1 (no neutral)
[APP][Pro] WhatsApp - Simple. Reliable. Private
[APP][Pro] WhatsApp - Simple. Reliable. Private
[APP][Pro] WhatsApp - Simple. Reliable. Private
Zigbee Aqara temperature devices not connecting after replacing battery
[HowTo] Homey Pro (Early 2023) - Migrating from Homey (Pro) (Early 2016-2019)
Hue Bride Pro Connect met Homey Pro
Om naar Homey 2023 PRO maar alle zigbee devices offline (help)
[HowTo] Homey Pro (Early 2023) - Migrating from Homey (Pro) (Early 2016-2019)
Zigbee reset - alternate approach - would that work?
Nieuwe update hue, zorgt voor com problemen
Zigbee reset
HP 2023 and Zigbee being soooo busy
[APP][Pro] < group > (3.2.4 - Stable)
Help with 2019 to 2023 migration - ZigBee
Homey pro does not find the device
Unable to repair Zigbee Devices after Migration
Devolo TĂźr-/Fensterkontakt LED einschalten?
The new Philips Hue Bridge
Transfer and restore a backup from one HomeĐ˝ to another while preserving Flows (Homey Pro 2023)
Sonos units dropped out and need to re-add all
[APP][Cloud & Pro] SwitchBot (Release 2.0.35, Test 2.0.49)
All my Zigbee devices do not work HP23
Tado: invalid refresh token (expired)
Zigbee not pairing, athom not responding
Flow parameters gone when device is removed
Tuya Cloud App „Please configure App first“
[APP][Pro] Tuya Zigbee App
Feature request: placeholder for replaced device in flow
Homey pro going crazy
All my yeelight Lamps are lost every few days
[APP][Pro] Roborock Vacuum Cleaners
Which Nest Cam is which
[APP][Pro][Cloud] P2000 for Homey (Dutch 112 (911) alerts
[Abandoned] deCONZ
[APP][Pro] Xiaomi Mi Home App
[APP][Pro] WhatsApp - Simple. Reliable. Private
[TUTORIAL][PRO] Install Home Assistant community store app, and Athom app side-by-side
[APP] Aqara & Xiaomi Smart Home - Simplify your life with a smarter home
Homey don't find zigbee units after last updated to version 10.0.6(09.02.2024)
[APP][Pro] tadoZones community (met geofence & verw. capaciteit) (NL)
[APP][Pro] WhatsApp - Simple. Reliable. Private
Reconnecting Aqara Button using M3 hub and Matter
[APP][Pro] Tuya Cloud - This app allows you to connect Homey to the Tuya cloud
Connected HUE hub with Matter. Flows broken. No scenes?!
"Gerät wechseln"-Funktion fßr Flows?
[APP] Fibaro - Your home is your castle (by Athom)
[APP][Pro] Eufy Security
False and ghost reports commands
Kan ik matter devices gekoppeld aan homey koppelen aan andere apps?
Temperatures qui ne se mettent pas a jour
Fibaro Smart Implant
[APP][Pro&Cloud] Shelly
1 van de Daikin units wil niet meer connecteren
[FeatureRequest] Replace a device
Nieuwe TADO app
[APP] Aqara & Xiaomi Smart Home - Simplify your life with a smarter home
Replace Device old to new
Z-Wave unreachable issues
Fibaro probleem na overstap nieuwe homey
[APP][Pro] WhatsApp - Simple. Reliable. Private
Issues with Zigbee network
[Homey Pro 2023] Informationen und Diskussionen zu neuen Firmware-Updates
[APP][Pro] WhatsApp - Simple. Reliable. Private
Zwave meldingen
Missing Capability Listener error
Homey Pro migration is a total failure
[APP][Pro] Device Capabilities - Enhance the capabilities of devices
[APP][Pro] Misol and Ecowitt (Release 0.2.10, Test 0.2.10 )
Z-Wave Geräte-Firmware-Updates mit Homey durchfßhren
[APP][Pro] Solis Cloud Inverter - Receive realtime data from your Solis Inverter
Fragen zur korrekten Nutzung von Homey Pro | Knoten im Kopf
Two IKEA spots don't wanna play nice
Hue motion sensor not coming online after battery replacement
Reparatur von Zigbee Geräten nach Migration vom HP19 auf den HP23 nicht mÜglich
Zwave no_ack
Change scale virtual therrmostat
Apparaten niet meer bereikbaar
[APP][Pro&Cloud] Shelly
Device Unavailable invalid_node
Tuya API
Aqara/Xiaomi - which devices can be updated?
[APP][Pro] Device Capabilities - Enhance the capabilities of devices
[APP][Pro&Cloud] Shelly
[APP][Pro] Advanced Virtual Device (Device Capabilities App) with Unique Text Status Indicator
[APP][Pro] ELKO Smart (deprecated)
Not working after latest update

Maestro, :pray::pray::pray:

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::tada: 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 :grimacing: (Warning: it does not have to be fixed today, or tomorrow :upside_down_face::crazy_face:)

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::nerd_face:

1 Like

Depends on the access roles. Web API has more rights

1 Like

Added advanced flows support :slight_smile:

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:

:call_me_hand:that makes perfectly sense, Martijn. Thanks.

Great Tool!! Thanks a lot !!

1 Like

Really nice Martijn!
Saved me allot of time today!

1 Like

Thanks,!!!

Did buy you a beer.
Removed and re-added 2 Shelly devices.
Great app.
Saves a lot of time.

1 Like

Thanks a lot man!

@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