[APP][Pro] Device Capabilities - Enhance the capabilities of devices

Hi,
I’m trying to use following flow: The Flow Exchange(r) - Exchange Your Flows with Others! - #82 by Peter_Kawa
However, during running the Homey Playground API, i got the following error:

"root":{1 item
"error":string"Cannot read properties of undefined (reading 'split')"
}

I got this error with more templates, but not with all templates. Some are generated successfully.
Is this a known issue?

Code generated by DC:

async function run() { let exchangerFile={"zonesToReplace":[{"name":"[000] Test","replacements":[{"id":"8a6928ea-26b2-4922-9ead-d20ee6695dd3","name":"Badkamer","$$hashKey":"object:371"},{"id":"855113f1-f488-4223-b675-2f01270f573e","name":"Begane grond","$$hashKey":"object:372"},{"id":"381a3e64-6b61-4d6b-bf8e-5a2f0d30a5e1","name":"Buiten","$$hashKey":"object:373"},{"id":"b840a982-a3a7-4513-9d96-902d81128f5c","name":"Eerste verdieping","$$hashKey":"object:374"},{"id":"478cfd92-6475-4214-80d9-27125e39863a","name":"Gang","$$hashKey":"object:375"},{"id":"37782dac-6d40-40a2-a0a4-17a0dd05003a","name":"Kelder","$$hashKey":"object:376"},{"id":"2ab5a003-0120-4c01-80f2-a237dcf4ba14","name":"Keuken","$$hashKey":"object:377"},{"id":"ddc3cdaa-8172-4c4a-97c9-22d8ec462972","name":"Slaapkamer","$$hashKey":"object:378"},{"id":"1815c884-af06-4d53-a2c1-6f4c77e9eb4e","name":"Studeerkamer","$$hashKey":"object:379"},{"id":"9919ee1e-ffbc-480b-bc4b-77fb047e9e68","name":"Thuis","$$hashKey":"object:380"},{"id":"5204dc44-8e9c-49e7-aed8-9d5c93330126","name":"Tuin","$$hashKey":"object:381"},{"id":"9eb2975d-49ea-4033-8db0-105a3e982117","name":"Woonkamer","$$hashKey":"object:382"},{"id":"6a48add5-7349-4ff3-84b9-812e2d706e50","name":"Zolder","$$hashKey":"object:383"}],"id":"9fc79e23-76b0-4ee6-80c5-a033b66b277d","$$hashKey":"object:358","replaceWithId":"8a6928ea-26b2-4922-9ead-d20ee6695dd3","replaceWith":{"id":"8a6928ea-26b2-4922-9ead-d20ee6695dd3","name":"Badkamer","$$hashKey":"object:371"},"searchFor":"homey:zone:9fc79e23-76b0-4ee6-80c5-a033b66b277d","searchReplaceWith":"homey:zone:8a6928ea-26b2-4922-9ead-d20ee6695dd3"}],"devicesToReplace":[{"name":"Lamp Hal","class":"light","replacements":[],"actions":["on","off"],"conditions":["on"],"id":"9f6e935e-8514-44fd-8748-89995c7edbe0","tags":[],"$$hashKey":"object:361"},{"name":"Button","class":"other","replacements":[],"triggers":["trigger_virtualdevice_button"],"id":"ca581209-de4b-40a8-b27c-74a22628c0f9","tags":[],"$$hashKey":"object:362"}],"variablesToReplace":[{"name":"Button ON","type":"boolean","replacements":[{"id":-1,"name":"-- Create --","newName":"Button ON","$$hashKey":"object:397"},{"id":"663f834b-3ebc-4307-95ee-d78ced675315","name":"Kelder Aan","$$hashKey":"object:398"}],"replaceWith":{"id":"663f834b-3ebc-4307-95ee-d78ced675315","name":"Kelder Aan","$$hashKey":"object:398"},"replaceWithId":"663f834b-3ebc-4307-95ee-d78ced675315","id":"7cecb623-c641-404b-8606-2e91a173d1d4","$$hashKey":"object:366","searchFor":"homey:manager:logic|7cecb623-c641-404b-8606-2e91a173d1d4","searchReplaceWith":"homey:manager:logic|663f834b-3ebc-4307-95ee-d78ced675315"}],"tokensToReplace":[{"name":"Chronograph","types":[[{"name":"TimerX","replacements":[{"id":-1,"name":"-- Create --","newName":"TimerX","$$hashKey":"object:407"}],"replaceWith":{"id":-1,"name":"-- Create --","newName":"Timer5"},"replaceWithId":-1,"$$hashKey":"object:405","searchFor":"homey:app:nl.fellownet.chronograph|TimerX","searchReplaceWith":"homey:app:nl.fellownet.chronograph|Timer5"}]],"id":"nl.fellownet.chronograph","tokens":[],"args":[],"$$hashKey":"object:369"}],"advancedflows":[{"id":"2ac8ca1b-27d7-49e9-ac74-23bfa8c73b4c","name":"Zone activated Device with Button OnOff","cards":{"c7fc4c21-cad0-423c-9d04-afb245b9b04d":{"x":1040,"y":380,"ownerUri":"homey:app:nl.fellownet.chronograph","id":"homey:app:nl.fellownet.chronograph:timer_pause","type":"action","args":{"name":"Timer5"}},"665241e4-b96c-43c5-8fe8-1b743cd6fc16":{"x":1040,"y":300,"ownerUri":"homey:device:9f6e935e-8514-44fd-8748-89995c7edbe0","id":"homey:device:9f6e935e-8514-44fd-8748-89995c7edbe0:on","type":"action"},"0aee7f90-c3f4-43fb-a9bb-850fcb75054e":{"x":40,"y":780,"ownerUri":"homey:zone:8a6928ea-26b2-4922-9ead-d20ee6695dd3","id":"homey:zone:8a6928ea-26b2-4922-9ead-d20ee6695dd3:inactive","type":"trigger","outputSuccess":["a8364eed-e2a1-4736-891d-d12045073ebb"]},"9b2c9c12-0d50-44cc-8608-49d8134fee48":{"x":40,"y":1060,"ownerUri":"homey:app:nl.fellownet.chronograph","id":"homey:app:nl.fellownet.chronograph:timer_finished","type":"trigger","outputSuccess":["e80bb293-e370-4b49-8ce2-ba05c93b8a0a"],"args":{"name":"Timer5"}},"476a8fe9-255a-4beb-beb8-a920bde3188a":{"x":40,"y":280,"ownerUri":"homey:zone:8a6928ea-26b2-4922-9ead-d20ee6695dd3","id":"homey:zone:8a6928ea-26b2-4922-9ead-d20ee6695dd3:active","type":"trigger","outputSuccess":["4c390726-4bdc-4216-869d-0d3a169239b6"]},"43edeae5-8e5d-459f-ad1d-5c94e7e07d13":{"x":1040,"y":1060,"ownerUri":"homey:device:9f6e935e-8514-44fd-8748-89995c7edbe0","id":"homey:device:9f6e935e-8514-44fd-8748-89995c7edbe0:off","type":"action"},"9d2b8019-1cad-4ef4-8103-5eaadc3ba163":{"x":640,"y":300,"ownerUri":"homey:device:9f6e935e-8514-44fd-8748-89995c7edbe0","id":"homey:device:9f6e935e-8514-44fd-8748-89995c7edbe0:on","type":"condition","outputTrue":["665241e4-b96c-43c5-8fe8-1b743cd6fc16"],"inverted":true},"e80bb293-e370-4b49-8ce2-ba05c93b8a0a":{"x":640,"y":1060,"ownerUri":"homey:device:9f6e935e-8514-44fd-8748-89995c7edbe0","id":"homey:device:9f6e935e-8514-44fd-8748-89995c7edbe0:on","type":"condition","outputTrue":["43edeae5-8e5d-459f-ad1d-5c94e7e07d13"],"inverted":false},"e84d9679-4a2d-4472-967b-7967d69fd798":{"x":1040,"y":760,"ownerUri":"homey:app:nl.fellownet.chronograph","id":"homey:app:nl.fellownet.chronograph:timer_start_v2","type":"action","args":{"name":"Timer5","time":"3","unit":"minutes"}},"4c390726-4bdc-4216-869d-0d3a169239b6":{"x":460,"y":400,"type":"any","outputSuccess":["c7fc4c21-cad0-423c-9d04-afb245b9b04d","9d2b8019-1cad-4ef4-8103-5eaadc3ba163"]},"88f60bd8-9431-4e2a-8c40-bafb5c5e7e10":{"x":40,"y":460,"ownerUri":"homey:device:ca581209-de4b-40a8-b27c-74a22628c0f9","id":"homey:device:ca581209-de4b-40a8-b27c-74a22628c0f9:trigger_virtualdevice_button","type":"trigger","outputSuccess":["4c390726-4bdc-4216-869d-0d3a169239b6","d7c4cc1f-c732-418a-83b6-b3e1f2f551c0"],"args":{"field":{"id":"button1","name":"Button","description":"Button 1"},"mode":"set"}},"76db780c-49b5-4fe4-9ec5-18e9abc58cd2":{"value":"When","color":"yellow","x":40,"y":0,"width":null,"height":null,"type":"note"},"903f46a0-0fa3-41b5-8b76-e9e9503bad16":{"value":"And","color":"yellow","x":520,"y":0,"width":null,"height":null,"type":"note"},"df8b9e8f-caee-4217-9aad-d1733da6bb2a":{"value":"Then","color":"yellow","x":1040,"y":0,"width":null,"height":null,"type":"note"},"9b873d04-dd9e-4042-8fb1-563fae86d04c":{"value":"Motion sensor(s) and Garage Door Contact(s)","color":"green","x":40,"y":180,"width":null,"height":null,"type":"note"},"cba9bd35-244c-4b9e-8e26-03e596883276":{"value":"Push button","color":"green","x":40,"y":400,"width":null,"height":null,"type":"note"},"50e514ab-ea0a-4ca5-a27f-853cb146b4cd":{"value":"Motion sensor(s) & Garage Door Contact(s)","color":"green","x":40,"y":700,"width":null,"height":null,"type":"note"},"c8a0daf8-2daf-42b3-9ada-65fbe56879db":{"value":"Light OFF flows","color":"red","x":0,"y":620,"width":null,"height":null,"type":"note"},"f8c5abe0-df1b-43d6-86ea-584ac1e14612":{"value":"Light ON flows","color":"red","x":0,"y":100,"width":null,"height":null,"type":"note"},"d7c4cc1f-c732-418a-83b6-b3e1f2f551c0":{"x":1040,"y":460,"ownerUri":"homey:manager:logic","id":"homey:manager:logic:variable_set_boolean","type":"action","args":{"variable":{"id":"663f834b-3ebc-4307-95ee-d78ced675315","name":"Kelder Aan"},"value":true}},"143c150a-ca94-46b2-b0da-ab3e9188c3c5":{"x":440,"y":940,"ownerUri":"homey:manager:logic","id":"homey:manager:logic:equal_boolean","type":"condition","outputTrue":["a29fa991-411f-4f79-a7ba-e9c068850dcc","e80bb293-e370-4b49-8ce2-ba05c93b8a0a"],"outputFalse":[],"droptoken":"homey:manager:logic|663f834b-3ebc-4307-95ee-d78ced675315"},"87eb55e9-6f86-4f44-88cf-cd93c48977ee":{"x":40,"y":940,"ownerUri":"homey:device:ca581209-de4b-40a8-b27c-74a22628c0f9","id":"homey:device:ca581209-de4b-40a8-b27c-74a22628c0f9:trigger_virtualdevice_button","type":"trigger","outputSuccess":["143c150a-ca94-46b2-b0da-ab3e9188c3c5"],"args":{"field":{"id":"button1","name":"Button","description":"Button 1"},"mode":"set"}},"ff4492d2-1b1f-4f20-9d68-9094bfe34dd3":{"value":"Push Button","color":"green","x":40,"y":880,"width":null,"height":null,"type":"note"},"a29fa991-411f-4f79-a7ba-e9c068850dcc":{"x":1040,"y":940,"ownerUri":"homey:manager:logic","id":"homey:manager:logic:variable_set_boolean","type":"action","args":{"variable":{"id":"663f834b-3ebc-4307-95ee-d78ced675315","name":"Kelder Aan"},"value":false}},"a8364eed-e2a1-4736-891d-d12045073ebb":{"x":640,"y":780,"ownerUri":"homey:manager:logic","id":"homey:manager:logic:equal_boolean","type":"condition","outputTrue":["e84d9679-4a2d-4472-967b-7967d69fd798"],"outputFalse":[],"inverted":true,"droptoken":"homey:manager:logic|663f834b-3ebc-4307-95ee-d78ced675315"}},"$$hashKey":"object:355","cardlength":25}],"flowsToReplace":[],"usersToReplace":[]};
                for(let i=0;i<exchangerFile.advancedflows.length;i++) {
                    let oldId = exchangerFile.advancedflows[i].id;
                    exchangerFile.advancedflows[i] = await Homey.flow.createAdvancedFlow({advancedflow:exchangerFile.advancedflows[i]});
                    if(exchangerFile.flowsToReplace && exchangerFile.flowsToReplace[oldId]) {
                        _.each(exchangerFile.flowsToReplace[oldId].types, type=> {
                            if(type.replaceWithId===oldId) type.replaceWith = {id:exchangerFile.advancedflows[i].id, name:exchangerFile.advancedflows[i].name};
                        });
                    }
                }
                for (let i = 0; i < exchangerFile.variablesToReplace.length; i++) {
                    const variable = exchangerFile.variablesToReplace[i];
                    if(variable.replaceWithId===-1) {
                        let val = variable.type=='string' ? '' : variable.type=='boolean' ? false : variable.type=='number' ? 0 : undefined;

                        variable.replaceWith = await Homey.logic.createVariable({ variable: {name:variable.replaceWith.id===-1?variable.replaceWith.newName : variable.replaceWith.name, type:variable.type, value:val} });
                        variable.searchFor = "homey:manager:logic|"+variable.id;
                        variable.searchReplaceWith = "homey:manager:logic|" + variable.replaceWith.id;
                    }  else exchangerFile.variablesToReplace[i] = null;
                }

                for(let afIndex=0;afIndex<exchangerFile.advancedflows.length;afIndex++) {
                    let update = false;
                    for (const cardKey in exchangerFile.advancedflows[afIndex].cards) {
                        if (Object.hasOwnProperty.call(exchangerFile.advancedflows[afIndex].cards, cardKey)) {
                            const card = exchangerFile.advancedflows[afIndex].cards[cardKey];
                            const c=card;
                            if(card && card.id && card.id.startsWith('homey:manager:flow:') && card.args && card.args.flow) {                            
                                for(let i=0;i<exchangerFile.flowsToReplace.length;i++) {
                                    for(let j=0;j<exchangerFile.flowsToReplace[i].types.length;j++) {                                
                                        if(card.id === ('programmatic_trigger' + (exchangerFile.flowsToReplace[i].types[j].id===''?'': '_' + exchangerFile.flowsToReplace[i].types[j].id + '_tag' )) && card.args.flow.id===exchangerFile.flowsToReplace[i].id && exchangerFile.flowsToReplace[i].types[j].replaceWith) {
                                            card.args.flow.id = exchangerFile.flowsToReplace[i].types[j].replaceWith.id;
                                            card.args.flow.name = exchangerFile.flowsToReplace[i].types[j].replaceWith.name;
                                            update = true;
                                        }
                                    }
                                    
                                }
                            }

                            if(c.args) for (const argKey in c.args) {
                                if (Object.hasOwnProperty.call(c.args, argKey)) {
                                    //const c.args[argKey] = c.args[argKey];
                                    switch (typeof(c.args[argKey])) {
                                        case "string":      
                                            _.each(exchangerFile.variablesToReplace, (variable)=>{
                                                if(!variable) return;
                                                if(variable.searchFor) {
                                                    if(c.args[argKey] === variable.searchFor) 
                                                    { c.args[argKey] = variable.searchReplaceWith; update = true; }
                                                    else if(c.args[argKey].indexOf("[[" + variable.searchFor + "]]")>-1) 
                                                    { c.args[argKey] = c.args[argKey].replaceAll("[[" + variable.searchFor + "]]", "[[" +variable.searchReplaceWith + "]]");  update = true; }
                                                } 
                                            });
                                            break;
                                        case "object":      
                                            if(c.args[argKey].id && c.id && c.id.startsWith('homey:manager:logic:')) _.each(exchangerFile.variablesToReplace, (variable)=>{ 
                                                if(!variable) return;
                                                if(variable.searchFor && c.args[argKey].id==variable.id && variable.replaceWith) {                                                
                                                    c.args[argKey].id = variable.replaceWith.id; c.args[argKey].name = variable.replaceWith.name;
                                                    update = true;
                                                }  
                                            });                                        
                                            break;
                                    }
                                }
                            }
                            if(c.droptoken) _.each(exchangerFile.variablesToReplace, (variable)=>{ 
                                if(!variable) return;
                                if(variable.searchFor && c.droptoken==variable.searchFor && variable.replaceWith) {                                                
                                    c.droptoken = variable.searchReplaceWith;
                                    update = true;
                                }  
                            }); 
                        }

                        if(update) {
                            exchangerFile.advancedflows[afIndex] = await Homey.flow.updateAdvancedFlow({id: exchangerFile.advancedflows[afIndex].id, advancedflow:
                                {cards: exchangerFile.advancedflows[afIndex].cards}
                            });
                        }
                    }
                }
            };
            run();