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

**URL:** <https://community.homey.app/t/homey-flowtoken-getflowtokens-no-longer-works-with-the-new-homey-api/111749>\
**Category:** Questions & Help\
**Created:** [June 20, 2024, 5:32am UTC](https://community.homey.app/t/homey-flowtoken-getflowtokens-no-longer-works-with-the-new-homey-api/111749 "2024-06-20T05:32:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Freek\_Smits](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/freek_smits/32/33854_2.png) [@Freek\_Smits](https://community.homey.app/u/Freek_Smits)\
**Post date:** [June 20, 2024, 5:32am UTC](https://community.homey.app/t/homey-flowtoken-getflowtokens-no-longer-works-with-the-new-homey-api/111749/1 "2024-06-20T05:32:55Z")

</div>

I often create variables with the function tag, example:

```auto
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:

```auto
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](https://athombv.github.io/com.athom.homeyscript/tutorial-migrate) 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?

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [June 20, 2024, 6:49am UTC](https://community.homey.app/t/homey-flowtoken-getflowtokens-no-longer-works-with-the-new-homey-api/111749/2 "2024-06-20T06:49:15Z")

</div>

[`Homey.flowtoken.getFlowTokens()`](https://athombv.github.io/node-homey-api/HomeyAPIV2.ManagerFlowToken.html)

---

<div class="post-metadata">

**Author:** ![Freek\_Smits](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/freek_smits/32/33854_2.png) [@Freek\_Smits](https://community.homey.app/u/Freek_Smits)\
**Post date:** [June 20, 2024, 7:48am UTC](https://community.homey.app/t/homey-flowtoken-getflowtokens-no-longer-works-with-the-new-homey-api/111749/3 "2024-06-20T07:48:00Z")

</div>

Hi Robert, Thank you for your quick response.

---

<div class="post-metadata">

**Author:** ![Marcel\_Kouwenberg](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_kouwenberg/32/47966_2.png) [@Marcel\_Kouwenberg](https://community.homey.app/u/Marcel_Kouwenberg)\
**Post date:** [September 15, 2024, 10:02am UTC](https://community.homey.app/t/homey-flowtoken-getflowtokens-no-longer-works-with-the-new-homey-api/111749/4 "2024-09-15T10:02:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [September 15, 2024, 10:55am UTC](https://community.homey.app/t/homey-flowtoken-getflowtokens-no-longer-works-with-the-new-homey-api/111749/5 "2024-09-15T10:55:29Z")

</div>

> [@Marcel\_Kouwenberg](#):
>
> So what is the needed change here ??

This:

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

```

Should be:

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

```

---

<div class="post-metadata">

**Author:** ![Marcel\_Kouwenberg](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_kouwenberg/32/47966_2.png) [@Marcel\_Kouwenberg](https://community.homey.app/u/Marcel_Kouwenberg)\
**Post date:** [September 15, 2024, 12:54pm UTC](https://community.homey.app/t/homey-flowtoken-getflowtokens-no-longer-works-with-the-new-homey-api/111749/6 "2024-09-15T12:54:03Z")

</div>

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

Marcel
