"Homey.flowToken.getFlowTokens()" no longer works with the new homey-api

I often create variables with the function tag, example:

await tag('Group_1_test_1', '-')
await tag('Group_1_test_2', '-')
await tag('Group_1_test_3', '-')

I read them again with the script below:

let flowTokens = await Homey.flowToken.getFlowTokens();

for (const flowToken of Object.values(flowTokens)) {
  if (flowToken.uri == 'homey:app:com.athom.homeyscript'  
      && flowToken.title.startsWith('Group_1') ) {
      log(flowToken.title)
    }  
}  

Output the classic version of the script
Group_1_test_1
Group_1_test_2
Group_1_test_3

This script has been marked as “Classic”, “Deprecated API version” for several months now.
When I create a new script, I get the following error message as output:
TypeError: Cannot read properties of undefined (reading ‘getFlowTokens’)

From the description of Tutorial: Migrating deprecated scripts - HomeyScript it is not clear to me what exactly I need to adjust.
Does anyone know what exactly I need to adjust to read the tags again?

Homey.flowtoken.getFlowTokens()

Hi Robert, Thank you for your quick response.

Hi Freek,

I have the same kind of problem, but even with the link from robert it’s not clear to mee what needs to change.

I want to save previous values to enable to compare them with current values. And they are not elswhere available . Up to now i used the tag function to store then and the homey.flowToken.getFlowTokens() to retrieve them.

// Declaration
let allTokens = await Homey.flowToken.getFlowTokens();

//Storing the value like this
await tag(“Stekker”+myDevice, TotaalVerbruikStekker );

// Getting the value like this
Object.values(allTokens).forEach(allToken => {
if(allToken.title == “Stekker”+myDevice) {
vorigTotaalStekker = allToken.value;
}
})

So what is the needed change here ??

Marcel

This:

let allTokens = await Homey.flowToken.getFlowTokens();

Should be:

let allTokens = await Homey.flowtoken.getFlowTokens();

OMG, Thanks Robert… it’s all in the initcap in this case

Marcel