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

@martijnpoppen @late4marshmellow , thank you for the scripts, both work now!

when im a few days off work i will transfer/repair many devices, so then i use this script :rofl:
because i’m gonna try to change the philips hue bridge to switch from the hue app to Matter protocal en hope the delays are gone then. but i will do this when i’m free from work, otherwise my wife keeps yelling at me that ā€œNothingā€ works in our home :upside_down_face:

maybe to make it easier if its possible?, can you also search by the app that the device falls under? so for example I can see all the id’s of the devices in an overview that fall under the Hue bridge app

1 Like

In Homeyscript you can run this:

// Replace "appName" with the driverURI, which is homey:app: followed by the reversed url behind /app/ in the app store URL, between the / / character ;P 
// for example: https://homey.app/nl-nl/app/nl.philips.hue/Philips-Hue/ should result in  homey:app:nl.philips.hue

let appName = "homey:app:nl.philips.hue"
// end of user input

const myDevices = await Homey.devices.getDevices();
for (var iMyDevice in myDevices){
  if (myDevices[iMyDevice].driverUri == appName) {
  log(`Device:\t ${myDevices[iMyDevice].name} \nZone:\t ${myDevices[iMyDevice].zoneName}\nID:\t ${myDevices[iMyDevice].id}`)
  }
};
//if (deviceName == "") {
if (appName == "") { 
  return false
} else {
  return true;
}



In the Web Playground you can use this (but I don’t get it to work at the moment)
→ replace com.mi.flora with nl.philips.hue :

2 Likes

Thank you! that worked!
I couldn’t resist and just transferred my hue bridge from the hue app to matter. however, there are quite a few flow cards missing which are important to me, so think I’m going to report it to athom and switch back to the hue bridge app

3 Likes

@martijnpoppen I notice when repairing the flows that he does not include the normal flows. all the advanced flows he repaired but not the normal flows.

see below, the advanced flows are the same as before because the script did this and the normale flow is not repaired.


Try to run it multiple times, that usually works for me.

2 Likes

Does this work? Because when you try it one time the id is the new id and the old id is gone right?

Nope,just first time it might fix first occurrence, then 2nd etc. - you can’t break anything by running it multiple times

2 Likes

aah oke good to know. thanks

@martijnpoppen , Thank you very much for making this script! Today I was reincluding my heat pump, because of the new device classes released from Athom. This script made it super easy to repair all my flows.

1 Like

Unfortunately I have the same issue.
Console output:

Advanced flows: Succes
Basic flows: No Succes

@martijnpoppen does it have something to do with Homey Script classic?

@Sebby5 by the looks you are using homeyscript.
Please check the instructions again. This doesn’t work in homeyscript

This was the log from the Web API playground :slight_smile:

@Sebby5 sorry. Please ignore my previous message :stuck_out_tongue:

Can you give a bit more explaination what you’re trying?

Like replacing the same device or is it a different device

1 Like

I am trying to replace TadoZones devices:

Which succeeded in the advance flows, but failed in the classic flows.
I get the same error message like you get when trying to save a flow with invalid cards.

To me it looks like the script cannot succeed in replacing the Device ID’s and then saves that flow, causing the same error.

@Sebby5 yeah most of the time this error occurs when the devices are different from each other. So when they don’t share the same flowcards

Maybe you can paste your flow here so I can have a look

You can do that with:

Homey.flow.getFlow({id: ā€œflowidhereā€})

You can find the flow id in the url when you open the flow in the webapp :slight_smile:

Sharing the flow with the native flow sharing fails at Athom’s end.
Here’s the code return.

{
  "id": "a3b06afb-8d21-449c-aa87-22ed6b21c31c",
  "uri": "homey:flow:a3b06afb-8d21-449c-aa87-22ed6b21c31c",
  "name": "Beganegrond Verwarmen",
  "enabled": true,
  "folder": "878e3270-5279-4994-99b4-6d219dba3265",
  "order": 136,
  "trigger": {
    "id": "homey:manager:flow:programmatic_trigger",
    "args": {}
  },
  "conditions": [],
  "actions": [
    {
      "id": "homey:device:71551d65-a4d6-41fc-aed8-1923c2aaf34b:target_temperature_set",
      "args": {
        "target_temperature": 19
      },
      "group": "then"
    },
    {
      "id": "homey:device:98261e5e-df99-4dbb-86ea-5a11f201d8bf:target_temperature_set",
      "group": "then",
      "delay": null,
      "duration": null,
      "args": {
        "target_temperature": 19
      }
    }
  ],
  "triggerable": true,
  "triggerCount": 0
}

@Sebby5 thats a default flowcard from Athom. :confused:

Can you confirm the new device has target_temperature_set ?

I can confirm that:

@Sebby5 better late than never :stuck_out_tongue:

I fixed the script for the issue you had

2 Likes

I have a problem in fixing basic flows as well; nothing seems to change in the flows concerned and I get the following error:

I am trying to change the flows by both ID and device names; same result… :frowning:
It concerns the same device which I removed from Homey and re-added again.
Doing it from Developer Tools of course and softrun is set to false.
Both Chrome and Edge result in the same.
Haven’t got this device in Advanced Flows, so i don’t know the result there.
Used the latest scripts from Github and am on Homey v12.1.2 and HomeyScript app v3.6.0.

Am I doing something wrong, or can something be wrong with (the compatibility?) of the script, @martijnpoppen? I’d be glad to supply any info you might want…