Homey.logic controls Homey’s built-in logic system, not Better Logic (which is a third-party app). See @JPe4619’s comment about how to set BL variables.
Also, HomeyScript has certain API limitations that the API Playground doesn’t have, hence the “You have no access to do this” error.
Can someone supply me with an example code how I can change a global variable or “tag” inside HomeyScript? I’m trying to change these tags:
I’ve managed to read the variables:
But I have no clue how to change them inside HomeyScript, as you can see from the console window, the value does not get updated. I’ve seen several posts about it, but all the scripts doesn’t seem to work or the thread is abandoned. Homey.logic.updateVariable({id: Logic.id, variable: {'value' : 'TEST!'}})
Doesn’t seem to work… but maybe I have mistaken the syntax. Anyone can provide me a working syntax?
So with the Syntax: await setTagValue(“klok12h”, {type:“number”, title: “Klok12H”}, theHour );
it will create a variable and store the data in that… And if it already exists it will update the value? And I can retrieve this value at a later stage? (with another HomeyScript).
How can I retrieve the value?
found the error… The pasted quotes : " where not the same. The compiler didn’t see the code between the quotes as strings.
Anyway, the code did run. Sadly I cannot find any trace of stored tags if I enumerate all the devices. I think these tags are only created at runtime. Makes more sense also, otherwise it would be a memory leak if these things never get destroyed.
So if anyone know a solution to store a variable, and retrieve that variable at a later stage with a different Homeyscript… I’m all ears. Thanks anyway JPE4619 for the support.
I have a hard time retrieving the Beter Logic variable. In my search I stumbled on this example:
the code: let allTokens = await Homey.flow.getTokens();
Should retrieve Beter Logic variable data… but when I try te code I get the following error in the console:
Script Error: Homey.flow.getTokens is not a function
Anyone who knows how to retrieve these better logic variables inside HomeyScript?