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

@sschot in the first post there’s nothing mentioned about homey script

The webapi playground is mentioned as that’s the only tool currently which has rights to update flows via the webapi

And please remove the links from your posts as those link to a specific version of my script. So when I update they will still go to the old version…

Hey Martijn,
Using the webapi playground, nothing happend. Using the method as described, it works.
I can not explain and will look soon again to webapi playground again, but for the moment glad that I could fix it my way.

edit: links removed

Hey
Alright :+1:t3:

Probably rights have changed for homey script as this was never possible

1 Like

Thanks for discovering this :blush:

Apparently somehow HS indeed has some new permissions, because the scripts never worked with HS. I’ve to admit I tested it once when the script was just published back in '22.

“Meten is weten” (a Dutch saying): I just tested with a Homeyscript and it managed to replace a device in standard+adv. flows.

Note: the other script, fix-flows-by-name.js also works @ Homeyscript.

Note 2:
Both scripts still work fine @ Web API Playground…

.

@sschot Steven, the reason why you didn’t see anything @ Playground:
When running the script with the softRun option set to true: you have to open the browser’s console to view the script logs;
Otherwise nothing happens onscreen, except “Request took xxxms”
It’s mentioned right below the true/false setting:
// Open the console in your browser and the result will be shown there // Howto open console: https://balsamiq.com/support/faqs/browserconsole/

1 Like

Peter,

Thanks for your confirmation regarding Homeyscripts.

When I used playground, my flows become not updated. So I will retry this soon when continuing to change devices from HP back to Dirigera.

Will post my final findings later on. Do you start the script with right click and start?

1 Like

Maybe run it using Playground and share screenshot from developer console from the Browser - eg. those showing some errors, that would also understand this better.

Problem determined, was not using true and false in the right way within Playground. Now both Playground and Homeyscript are working.

Thanks for all effort, sorry for my questions, this was all new for me!

2 Likes

I can confirm that it works in the Homey script. I created the script, entered the device ID or name, set it to false, saved it, and when you run the test within the script, it changes the flows where this device is connected. No need to do anything else.
Nice work :blush:.

1 Like

Hi.

This looks exactly what i want but i can´t seem to get it to work. I first tried with my heatpump to no avail, so now I´m experimenting with two virtual devices, that wouldn´t make a difference right? (They are same type and functions).
Collected the ID´s of the respective unit and pasted the “raw” version of the script from github. When running softRun = true i get no errors and it shows the simple flow it´s going to change but when changing to false, i get errors. Not sure what to do now, hope someone can help :slight_smile:

This is the error i get

@Matte_H sorry but i can’t tell you what is wrong that totally depends on your setup and your flows and devices

Ah, ok. Will try to search for other options. Now i saw …FIX (advanced) flows… on the headline. Does this only fix advanced flows? Those i tried were simple flows

@Matte_H advanced is in between brackets right? :stuck_out_tongue:
So it’s both

But if you want help from the people here, it’s best to share your flows and maybe also share the flow data so we can see what’s wrong

1 Like

Hi @martijnpoppen, yesterday I used your script for the first time. It worked great (after switching softRun from true to false:joy:) and it’s so much helpful! Thank you very much!

1 Like

@DirkG thanks! This should be default functionality in my opinion :stuck_out_tongue:

1 Like

Definitively

1 Like