# Variable not totally updated

**URL:** <https://community.homey.app/t/variable-not-totally-updated/82154>\
**Category:** Flows\
**Tags:** homeyscript, homey-pro\
**Created:** [June 11, 2023, 4:58pm UTC](https://community.homey.app/t/variable-not-totally-updated/82154 "2023-06-11T16:58:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mat\_Mat](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mat_mat/32/77766_2.png) [@Mat\_Mat](https://community.homey.app/u/Mat_Mat)\
**Post date:** [June 11, 2023, 4:58pm UTC](https://community.homey.app/t/variable-not-totally-updated/82154/1 "2023-06-11T16:58:07Z")

</div>

Hello

I ask me a question (Homey pro 2023), I developped small homey script using global variable. It’s works, the variable is correctly updated but I don’t understand why values are not update inside the homey interface ?

Exemple: I use 4 global variables. If I log all values, I can found good values:

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/a/7acdaae91d03386b6ba08c8b666bee3218b0b5ad.png)

But if I display them by homey, variable values stay same as initial values:

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/2/c25caca801c82f8245e5574559a30189d39f36e8.png)

Same thing inside the chart:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/b/abd4d8f9e5ffb38629443416b3069789ff7886bb.png)

Did I forget something?

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [June 11, 2023, 5:27pm UTC](https://community.homey.app/t/variable-not-totally-updated/82154/2 "2023-06-11T17:27:40Z")

</div>

Global variables are not the same as System variables.  
Global variables are created by HomeyScript, System variables you create in f.i. web app-flows editor like the ones you show here above.

example HomeyScript create globalvariable:

```auto
// Create Tags

log('Creating My String...');

await tag('My String', 'abcdef');

```

---

<div class="post-metadata">

**Author:** ![Mat\_Mat](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mat_mat/32/77766_2.png) [@Mat\_Mat](https://community.homey.app/u/Mat_Mat)\
**Post date:** [June 11, 2023, 5:41pm UTC](https://community.homey.app/t/variable-not-totally-updated/82154/3 "2023-06-11T17:41:34Z")

</div>

Oh thx a lot ! I will fix that 😃

---

<div class="post-metadata">

**Author:** ![Mat\_Mat](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mat_mat/32/77766_2.png) [@Mat\_Mat](https://community.homey.app/u/Mat_Mat)\
**Post date:** [June 11, 2023, 5:50pm UTC](https://community.homey.app/t/variable-not-totally-updated/82154/4 "2023-06-11T17:50:57Z")

</div>

So what is a difference between

- global.set(‘My String’, ‘abcdef’);

and

- await tag(‘My String’, ‘abcdef’);

Other question, It’s possible to edit System variable from homeyScript ?

---

<div class="post-metadata">

**Author:** ![JPe4619](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jpe4619/32/9017_2.png) [@JPe4619](https://community.homey.app/u/JPe4619)\
**Post date:** [June 11, 2023, 7:44pm UTC](https://community.homey.app/t/variable-not-totally-updated/82154/5 "2023-06-11T19:44:30Z")

</div>

search for “script” brougt me to:

> [@A (Homey) Script to find Any Items (Devices, Zones, Apps, Variables) in any flow](https://community.homey.app/t/a-homey-script-to-find-any-items-devices-zones-apps-variables-in-any-flow/69904):
>
> Here is a script that you can use to find any Variables, Devices, Zones or Apps in any Flow or Advanced Flow. This will be included into the [Device Capabilities App](https://homey.app/nl-nl/app/nl.qluster-it.DeviceCapabilities/Device-Capabilities/) and explanations for the flowcards will be placed on [[APP][Pro] Device Capabilities - Enhance the capabilities of devices - Apps - Homey Community Forum](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287). This topic can be used for the below script. You can use it in many ways, see the top of the script for examples. The Find Objects in Flows Script /// -- The Find Objects in Flo…

this guy nows it all!

---

<div class="post-metadata">

**Author:** ![Caseda](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/caseda/32/138695_2.png) [@Caseda](https://community.homey.app/u/Caseda)\
**Post date:** [June 11, 2023, 9:29pm UTC](https://community.homey.app/t/variable-not-totally-updated/82154/6 "2023-06-11T21:29:30Z")

</div>

Global = for (all) HomeyScript scipts  
Tag = Homey Tags/Tokens to be used in flows.

Yes it is possible to change Logic variables with HomeyScript, there is already some topics about it on the forum ~~somewhere~~.  
Found 1, not the one I first was thinking of, but has the same end results with the correct API points:

> [@Setting Logic Variable by HomeyScript](https://community.homey.app/t/14819):
>
> I Try to set value on a better logic variable follow other forum. I find out the varible’s ID and on “Web API Playground” i wrote the follow instruction: Homey.logic.updateVariable({id: “2de431c4-ddc1-49d8-b98b-536d9acd1d59”, variable: {“value” :48}}) Response “root”:{5 items “\_\_athom\_api\_type”:string"HomeyAPI.ManagerLogic.Variable" “id”:string"2de431c4-ddc1-49d8-b98b-536d9acd1d59" “name”:string"Power\_Surplus" “type”:string"number" “value”:int48} The variable is set . … Instead, Writi…
