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

@Sharkys Ah i understand.
so indeed the new FlowCardAction is different from the old one, that’s why it’s breaking as it is a “broken” flowcard and that’s not possible to create.

It might be possible to skip those. but it’s not possible change them

1 Like

So basically only having previous app installed still might work, right ?

No it means that flowcards should exist on the new APP.

So for example :

the old app has flowcard A and C

the new app has flowcard B and C

Then it will throw an error on FlowCard A as that doesn’t exist in the new app, but it tries to fix that ID

1 Like

Hm, because I didn’t understand what you mean exactly, I tried that anyway :wink:

So in this case, it’s about Roborock app (abanoned) and Xiaomi Mi Home app (full rewrite) - and I was able to transfer/migrate my flows.

With previous app disabled :

With previous app enabled and still working :

And it somehow corresponds, I still have two flows not migrated - example OLD and NEW one :

picture

So partial success :wink:

I’ll have a look if I can update this somehow :stuck_out_tongue:

1 Like

If i run this, nothing happens (no response?). Is this working for the Homey Pro 2023 as well?

Checkout the Console…there you will see what is happening.

Also you set softRun to FALSE or TRUE ? If you are using the script first time, highly recommended to first check out what it is doing (having softRUN set to TRUE)

1 Like

This is the console output.
There is no response coming at all, like when it does when for example running:
Homey.users.getUserMe();

type or paVM28:33 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'replace')
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:33:41)
    at Array.forEach (<anonymous>)
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:32:19)
    at Array.forEach (<anonymous>)
    at main (eval at <anonymous> (index.js:62:18), <anonymous>:12:26)
    at async Promise.all (index 0)
eval @ VM28:33
eval @ VM28:32
main @ VM28:12
await in main (async)
eval @ VM28:85
(anonymous) @ index.js:62
Promise.then (async)
(anonymous) @ index.js:60
PageToolsAPIPlayground.handleRun @ index.js:59
Ve @ react-dom.production.min.js:52
Xe @ react-dom.production.min.js:52
(anonymous) @ react-dom.production.min.js:53
jr @ react-dom.production.min.js:100
Ar @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
De @ react-dom.production.min.js:292
(anonymous) @ react-dom.production.min.js:50
Nr @ react-dom.production.min.js:105
Qt @ react-dom.production.min.js:75
Jt @ react-dom.production.min.js:74
t.unstable_runWithPriority @ scheduler.production.min.js:18
Go @ react-dom.production.min.js:122
Ie @ react-dom.production.min.js:292
Kt @ react-dom.production.min.js:73
VM28:47 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'replace')
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:47:44)
    at Array.forEach (<anonymous>)
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:46:22)
    at Array.forEach (<anonymous>)
    at main (eval at <anonymous> (index.js:62:18), <anonymous>:12:26)
    at async Promise.all (index 0)
eval @ VM28:47
eval @ VM28:46
main @ VM28:12
await in main (async)
eval @ VM28:85
(anonymous) @ index.js:62
Promise.then (async)
(anonymous) @ index.js:60
PageToolsAPIPlayground.handleRun @ index.js:59
Ve @ react-dom.production.min.js:52
Xe @ react-dom.production.min.js:52
(anonymous) @ react-dom.production.min.js:53
jr @ react-dom.production.min.js:100
Ar @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
De @ react-dom.production.min.js:292
(anonymous) @ react-dom.production.min.js:50
Nr @ react-dom.production.min.js:105
Qt @ react-dom.production.min.js:75
Jt @ react-dom.production.min.js:74
t.unstable_runWithPriority @ scheduler.production.min.js:18
Go @ react-dom.production.min.js:122
Ie @ react-dom.production.min.js:292
Kt @ react-dom.production.min.js:73
6VM28:33 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'replace')
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:33:41)
    at Array.forEach (<anonymous>)
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:32:19)
    at Array.forEach (<anonymous>)
    at main (eval at <anonymous> (index.js:62:18), <anonymous>:12:26)
    at async Promise.all (index 0)
eval @ VM28:33
eval @ VM28:32
main @ VM28:12
await in main (async)
eval @ VM28:85
(anonymous) @ index.js:62
Promise.then (async)
(anonymous) @ index.js:60
PageToolsAPIPlayground.handleRun @ index.js:59
Ve @ react-dom.production.min.js:52
Xe @ react-dom.production.min.js:52
(anonymous) @ react-dom.production.min.js:53
jr @ react-dom.production.min.js:100
Ar @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
De @ react-dom.production.min.js:292
(anonymous) @ react-dom.production.min.js:50
Nr @ react-dom.production.min.js:105
Qt @ react-dom.production.min.js:75
Jt @ react-dom.production.min.js:74
t.unstable_runWithPriority @ scheduler.production.min.js:18
Go @ react-dom.production.min.js:122
Ie @ react-dom.production.min.js:292
Kt @ react-dom.production.min.js:73
VM28:47 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'replace')
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:47:44)
    at Array.forEach (<anonymous>)
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:46:22)
    at Array.forEach (<anonymous>)
    at main (eval at <anonymous> (index.js:62:18), <anonymous>:12:26)
    at async Promise.all (index 0)
eval @ VM28:47
eval @ VM28:46
main @ VM28:12
await in main (async)
eval @ VM28:85
(anonymous) @ index.js:62
Promise.then (async)
(anonymous) @ index.js:60
PageToolsAPIPlayground.handleRun @ index.js:59
Ve @ react-dom.production.min.js:52
Xe @ react-dom.production.min.js:52
(anonymous) @ react-dom.production.min.js:53
jr @ react-dom.production.min.js:100
Ar @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
De @ react-dom.production.min.js:292
(anonymous) @ react-dom.production.min.js:50
Nr @ react-dom.production.min.js:105
Qt @ react-dom.production.min.js:75
Jt @ react-dom.production.min.js:74
t.unstable_runWithPriority @ scheduler.production.min.js:18
Go @ react-dom.production.min.js:122
Ie @ react-dom.production.min.js:292
Kt @ react-dom.production.min.js:73
2VM28:33 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'replace')
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:33:41)
    at Array.forEach (<anonymous>)
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:32:19)
    at Array.forEach (<anonymous>)
    at main (eval at <anonymous> (index.js:62:18), <anonymous>:12:26)
    at async Promise.all (index 0)
eval @ VM28:33
eval @ VM28:32
main @ VM28:12
await in main (async)
eval @ VM28:85
(anonymous) @ index.js:62
Promise.then (async)
(anonymous) @ index.js:60
PageToolsAPIPlayground.handleRun @ index.js:59
Ve @ react-dom.production.min.js:52
Xe @ react-dom.production.min.js:52
(anonymous) @ react-dom.production.min.js:53
jr @ react-dom.production.min.js:100
Ar @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
De @ react-dom.production.min.js:292
(anonymous) @ react-dom.production.min.js:50
Nr @ react-dom.production.min.js:105
Qt @ react-dom.production.min.js:75
Jt @ react-dom.production.min.js:74
t.unstable_runWithPriority @ scheduler.production.min.js:18
Go @ react-dom.production.min.js:122
Ie @ react-dom.production.min.js:292
Kt @ react-dom.production.min.js:73
VM28:47 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'replace')
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:47:44)
    at Array.forEach (<anonymous>)
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:46:22)
    at Array.forEach (<anonymous>)
    at main (eval at <anonymous> (index.js:62:18), <anonymous>:12:26)
    at async Promise.all (index 0)
eval @ VM28:47
eval @ VM28:46
main @ VM28:12
await in main (async)
eval @ VM28:85
(anonymous) @ index.js:62
Promise.then (async)
(anonymous) @ index.js:60
PageToolsAPIPlayground.handleRun @ index.js:59
Ve @ react-dom.production.min.js:52
Xe @ react-dom.production.min.js:52
(anonymous) @ react-dom.production.min.js:53
jr @ react-dom.production.min.js:100
Ar @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
De @ react-dom.production.min.js:292
(anonymous) @ react-dom.production.min.js:50
Nr @ react-dom.production.min.js:105
Qt @ react-dom.production.min.js:75
Jt @ react-dom.production.min.js:74
t.unstable_runWithPriority @ scheduler.production.min.js:18
Go @ react-dom.production.min.js:122
Ie @ react-dom.production.min.js:292
Kt @ react-dom.production.min.js:73
5VM28:33 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'replace')
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:33:41)
    at Array.forEach (<anonymous>)
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:32:19)
    at Array.forEach (<anonymous>)
    at main (eval at <anonymous> (index.js:62:18), <anonymous>:12:26)
    at async Promise.all (index 0)
eval @ VM28:33
eval @ VM28:32
main @ VM28:12
await in main (async)
eval @ VM28:85
(anonymous) @ index.js:62
Promise.then (async)
(anonymous) @ index.js:60
PageToolsAPIPlayground.handleRun @ index.js:59
Ve @ react-dom.production.min.js:52
Xe @ react-dom.production.min.js:52
(anonymous) @ react-dom.production.min.js:53
jr @ react-dom.production.min.js:100
Ar @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
De @ react-dom.production.min.js:292
(anonymous) @ react-dom.production.min.js:50
Nr @ react-dom.production.min.js:105
Qt @ react-dom.production.min.js:75
Jt @ react-dom.production.min.js:74
t.unstable_runWithPriority @ scheduler.production.min.js:18
Go @ react-dom.production.min.js:122
Ie @ react-dom.production.min.js:292
Kt @ react-dom.production.min.js:73
2VM28:47 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'replace')
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:47:44)
    at Array.forEach (<anonymous>)
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:46:22)
    at Array.forEach (<anonymous>)
    at main (eval at <anonymous> (index.js:62:18), <anonymous>:12:26)
    at async Promise.all (index 0)
eval @ VM28:47
eval @ VM28:46
main @ VM28:12
await in main (async)
eval @ VM28:85
(anonymous) @ index.js:62
Promise.then (async)
(anonymous) @ index.js:60
PageToolsAPIPlayground.handleRun @ index.js:59
Ve @ react-dom.production.min.js:52
Xe @ react-dom.production.min.js:52
(anonymous) @ react-dom.production.min.js:53
jr @ react-dom.production.min.js:100
Ar @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
De @ react-dom.production.min.js:292
(anonymous) @ react-dom.production.min.js:50
Nr @ react-dom.production.min.js:105
Qt @ react-dom.production.min.js:75
Jt @ react-dom.production.min.js:74
t.unstable_runWithPriority @ scheduler.production.min.js:18
Go @ react-dom.production.min.js:122
Ie @ react-dom.production.min.js:292
Kt @ react-dom.production.min.js:73
4VM28:33 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'replace')
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:33:41)
    at Array.forEach (<anonymous>)
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:32:19)
    at Array.forEach (<anonymous>)
    at main (eval at <anonymous> (index.js:62:18), <anonymous>:12:26)
    at async Promise.all (index 0)
eval @ VM28:33
eval @ VM28:32
main @ VM28:12
await in main (async)
eval @ VM28:85
(anonymous) @ index.js:62
Promise.then (async)
(anonymous) @ index.js:60
PageToolsAPIPlayground.handleRun @ index.js:59
Ve @ react-dom.production.min.js:52
Xe @ react-dom.production.min.js:52
(anonymous) @ react-dom.production.min.js:53
jr @ react-dom.production.min.js:100
Ar @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
De @ react-dom.production.min.js:292
(anonymous) @ react-dom.production.min.js:50
Nr @ react-dom.production.min.js:105
Qt @ react-dom.production.min.js:75
Jt @ react-dom.production.min.js:74
t.unstable_runWithPriority @ scheduler.production.min.js:18
Go @ react-dom.production.min.js:122
Ie @ react-dom.production.min.js:292
Kt @ react-dom.production.min.js:73
VM28:47 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'replace')
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:47:44)
    at Array.forEach (<anonymous>)
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:46:22)
    at Array.forEach (<anonymous>)
    at main (eval at <anonymous> (index.js:62:18), <anonymous>:12:26)
    at async Promise.all (index 0)
eval @ VM28:47
eval @ VM28:46
main @ VM28:12
await in main (async)
eval @ VM28:85
(anonymous) @ index.js:62
Promise.then (async)
(anonymous) @ index.js:60
PageToolsAPIPlayground.handleRun @ index.js:59
Ve @ react-dom.production.min.js:52
Xe @ react-dom.production.min.js:52
(anonymous) @ react-dom.production.min.js:53
jr @ react-dom.production.min.js:100
Ar @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
De @ react-dom.production.min.js:292
(anonymous) @ react-dom.production.min.js:50
Nr @ react-dom.production.min.js:105
Qt @ react-dom.production.min.js:75
Jt @ react-dom.production.min.js:74
t.unstable_runWithPriority @ scheduler.production.min.js:18
Go @ react-dom.production.min.js:122
Ie @ react-dom.production.min.js:292
Kt @ react-dom.production.min.js:73
5VM28:33 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'replace')
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:33:41)
    at Array.forEach (<anonymous>)
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:32:19)
    at Array.forEach (<anonymous>)
    at main (eval at <anonymous> (index.js:62:18), <anonymous>:12:26)
    at async Promise.all (index 0)
eval @ VM28:33
eval @ VM28:32
main @ VM28:12
await in main (async)
eval @ VM28:85
(anonymous) @ index.js:62
Promise.then (async)
(anonymous) @ index.js:60
PageToolsAPIPlayground.handleRun @ index.js:59
Ve @ react-dom.production.min.js:52
Xe @ react-dom.production.min.js:52
(anonymous) @ react-dom.production.min.js:53
jr @ react-dom.production.min.js:100
Ar @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
De @ react-dom.production.min.js:292
(anonymous) @ react-dom.production.min.js:50
Nr @ react-dom.production.min.js:105
Qt @ react-dom.production.min.js:75
Jt @ react-dom.production.min.js:74
t.unstable_runWithPriority @ scheduler.production.min.js:18
Go @ react-dom.production.min.js:122
Ie @ react-dom.production.min.js:292
Kt @ react-dom.production.min.js:73
VM28:47 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'replace')
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:47:44)
    at Array.forEach (<anonymous>)
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:46:22)
    at Array.forEach (<anonymous>)
    at main (eval at <anonymous> (index.js:62:18), <anonymous>:12:26)
    at async Promise.all (index 0)
eval @ VM28:47
eval @ VM28:46
main @ VM28:12
await in main (async)
eval @ VM28:85
(anonymous) @ index.js:62
Promise.then (async)
(anonymous) @ index.js:60
PageToolsAPIPlayground.handleRun @ index.js:59
Ve @ react-dom.production.min.js:52
Xe @ react-dom.production.min.js:52
(anonymous) @ react-dom.production.min.js:53
jr @ react-dom.production.min.js:100
Ar @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
De @ react-dom.production.min.js:292
(anonymous) @ react-dom.production.min.js:50
Nr @ react-dom.production.min.js:105
Qt @ react-dom.production.min.js:75
Jt @ react-dom.production.min.js:74
t.unstable_runWithPriority @ scheduler.production.min.js:18
Go @ react-dom.production.min.js:122
Ie @ react-dom.production.min.js:292
Kt @ react-dom.production.min.js:73
4VM28:33 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'replace')
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:33:41)
    at Array.forEach (<anonymous>)
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:32:19)
    at Array.forEach (<anonymous>)
    at main (eval at <anonymous> (index.js:62:18), <anonymous>:12:26)
    at async Promise.all (index 0)
eval @ VM28:33
eval @ VM28:32
main @ VM28:12
await in main (async)
eval @ VM28:85
(anonymous) @ index.js:62
Promise.then (async)
(anonymous) @ index.js:60
PageToolsAPIPlayground.handleRun @ index.js:59
Ve @ react-dom.production.min.js:52
Xe @ react-dom.production.min.js:52
(anonymous) @ react-dom.production.min.js:53
jr @ react-dom.production.min.js:100
Ar @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
De @ react-dom.production.min.js:292
(anonymous) @ react-dom.production.min.js:50
Nr @ react-dom.production.min.js:105
Qt @ react-dom.production.min.js:75
Jt @ react-dom.production.min.js:74
t.unstable_runWithPriority @ scheduler.production.min.js:18
Go @ react-dom.production.min.js:122
Ie @ react-dom.production.min.js:292
Kt @ react-dom.production.min.js:73
VM28:47 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'replace')
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:47:44)
    at Array.forEach (<anonymous>)
    at eval (eval at <anonymous> (index.js:62:18), <anonymous>:46:22)
    at Array.forEach (<anonymous>)ste code here

That doesn’t look healthy at all…but those are details already when expanded, or ?

no, can be expanded to a lot more…

I’ll have a look later @Stanley_Oei

Thanks. For now I manually updated the flows… But still nice to know what went wrong / what I did wrong.

1 Like

@martijnpoppen i have the same problem, when I want to repair a device (Xiaomi switch mini) everything seems to work. and as you can see, in the device setup the flows are coming back. but it doesn’t repair them on homey 2023


@Robin_De_Lange maybe its already using the new webapi. Will check!

1 Like

Hi @martijnpoppen ,

indeed seems it’s not compatible anymore with HP2023 ;-( I guess there isn’t “easy” fix, right ?

@Sharkys there will be,
Your last image just shows what i need :smiley:

Will update!

Edit: probably i’ll post 2 scripts, one for legacy and one for HP23

3 Likes

Oou… so no need to rewrite like 100 flows ? :wink: THANK YOUUUUU !

1 Like

No its that the webapi for Homey 2023 is updated and uri is removed. So have to do some checks, shouldnt be that hard.

Will probably have a fix tomorrow :slight_smile:

2 Likes

@Sharkys new script is ready (also added to top post): https://gist.githubusercontent.com/martijnpoppen/dcf0b8fd3f7fe63dec087c87dbc66090/raw/c15ede06bb4a26b6b06536e9751cfc7c0a89320a/gistfile2.txt

Next to that added variable support for advanced flows. I saw I didn’t include that earlier :stuck_out_tongue:

I would recommend softRun first :smiley:
The script should work for both Homeys now

2 Likes

You said tomorrow ! ;-)) Checking, testing… thank you !

1 Like