# HomeyScript and variables

**URL:** https://community.homey.app/t/homeyscript-and-variables/151192
**Category:** Questions & Help
**Created:** [February 16, 2026, 8:55am UTC](https://community.homey.app/t/homeyscript-and-variables/151192 "2026-02-16T08:55:31Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![harmenkuijer](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/harmenkuijer/32/120683_2.png) [@harmenkuijer](https://community.homey.app/u/harmenkuijer)
#### Post date: [February 16, 2026, 8:55am UTC](https://community.homey.app/t/homeyscript-and-variables/151192/1 "2026-02-16T08:55:31Z")

</div>

Hi,

for receiving a Bearer token I have created an HomeyScript. This script returns a variable and is saved as FSRBearerToken. I can see this variable in Homey and can use it in flows.

But now I have created another HomeyScript for collection some data and want to use this variable as well. Have tried several options but no luck. Anybody?

Tried the following:

```javascript
async function run() {
  const token = await Homey.tags.getValue('FSRBearerToken');
  if (!token) throw new Error('FSRBearerToken tag empty');
  }

```

And use the HomeyScript card adding an argument

```javascript
async function run(args) {
  const token = args.FSRBearerToken;
  if (!token) {
    throw new Error('FSRBearerToken argument missing');
  }

```

Using the direct token works perfectly

```javascript
async function run() {
  const token = 'ACTUAL_TOKEN';
  if (!token) {
    throw new Error('Token not found');
  }

```

---

<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: [February 16, 2026, 9:10am UTC](https://community.homey.app/t/homeyscript-and-variables/151192/2 "2026-02-16T09:10:29Z")

</div>

Was this code AI-generated?

---

<div class="post-metadata">

### Author: ![harmenkuijer](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/harmenkuijer/32/120683_2.png) [@harmenkuijer](https://community.homey.app/u/harmenkuijer)
#### Post date: [February 16, 2026, 9:23am UTC](https://community.homey.app/t/homeyscript-and-variables/151192/3 "2026-02-16T09:23:43Z")

</div>

@robertklep, thats correct

---

<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: [February 16, 2026, 9:27am UTC](https://community.homey.app/t/homeyscript-and-variables/151192/4 "2026-02-16T09:27:27Z")

</div>

Figures, it just basically hallucinated code that makes no sense.

If you want to share data between scripts, the easiest way is to use [`get()`](https://athombv.github.io/com.athom.homeyscript/global.html#.get)/[`set()`](https://athombv.github.io/com.athom.homeyscript/global.html#.set).

If you really want to use tags, [look here](https://github.com/athombv/com.athom.homeyscript/issues/31#issuecomment-812578431).

---

<div class="post-metadata">

### Author: ![harmenkuijer](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/harmenkuijer/32/120683_2.png) [@harmenkuijer](https://community.homey.app/u/harmenkuijer)
#### Post date: [February 16, 2026, 9:34am UTC](https://community.homey.app/t/homeyscript-and-variables/151192/5 "2026-02-16T09:34:53Z")

</div>

Thanks for this, sometimes it is a great help 😊 , but not this time.
