# Variables don't updated or not showing real value

**URL:** <https://community.homey.app/t/variables-dont-updated-or-not-showing-real-value/154033>\
**Category:** Flows\
**Tags:** advancedflow\
**Created:** [April 20, 2026, 8:24pm UTC](https://community.homey.app/t/variables-dont-updated-or-not-showing-real-value/154033 "2026-04-20T20:24:16Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [April 28, 2026, 10:33pm UTC](https://community.homey.app/t/variables-dont-updated-or-not-showing-real-value/154033/8 "2026-04-28T22:33:06Z")

</div>

> [@nacho\_PR-perso](#):
>
> Why are the variables appearing twice?

They don’t appear twice, but you’re mixing up Homeyscript “tags” with Logic variables. These are not related, but both can be used in flows.

You created a Homeyscript “tag” by some script, with the same name as your Logic variable. Or the other way 'round.  
That’s not what I would do (just too confusing).

 ![Screenshot20260429001638Vivaldi](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/2/c207ad2368e40e48226c6833f5d561fbbc72fa24.jpeg)

However, it’s possible to create & read Logic variables with Homeyscript as well, albeit quite complicated compared to Homeyscript tags.

```auto
//Name of Logic Variable
var name = "TVProgramma";

//Read Logic Var
var value = await ReadLogicVar(name);
console.log("The parameter '"+name+"' has a value '"+value+"'");

//Write Logic Var
var new_value = "NOS Journaal";
await WriteLogicVar(name,new_value);

async function ReadLogicVar(name){
  let Logic = await Homey.logic.getVariables();
  let idArr = Object.entries(Logic);
  let filtered = idArr.filter(([key,value]) => value.name==name);
  let [[,{id:varID}]] = filtered;

  var varArr = await Homey.logic.getVariable({id:varID});

  return varArr.value;
}

async function WriteLogicVar(name,value){
  let Logic = await Homey.logic.getVariables();
  let idArr = Object.entries(Logic);
  let filtered = idArr.filter(([key,value]) => value.name==name);
  let [[,{id:varID}]] = filtered;
  
  var varArr = await Homey.logic.getVariable({id:varID});

  if (typeof(value) == varArr.type){
    await Homey.logic.updateVariable({id:varID,variable:{value:value}})
    //console.log("Value has been updated")
    return true;
  }
  else{
    console.log("New value has the wrong type! Expected type is '"+varArr.type+"', not '"+typeof(value)+"'. Value has NOT been updated!")
    return false;
  }
}

```

Source:

> [@Setting Logic Variable by HomeyScript](https://community.homey.app/t/setting-logic-variable-by-homeyscript/14819/43):
>
> Here I have created two functions which you can add to your scripts. //Name of Logic Variable var name = "TVProgramma"; //Read Logic Var var value = await ReadLogicVar(name); console.log("The parameter '"+name+"' has a value '"+value+"'"); //Write Logic Var var new\_value = "NOS Journaal"; await WriteLogicVar(name,new\_value); async function ReadLogicVar(name){ let Logic = await Homey.logic.getVariables(); let idArr = Object.entries(Logic); let filtered = idArr.filter(([key,value]) =\> va…

---

_[View the full topic](https://community.homey.app/t/variables-dont-updated-or-not-showing-real-value/154033)._
