I try to create and set a betterlogic variable from Homeyscript:
let varName = "MyVar";
let betterLogicApp = await Homey.apps.getApp({ id: "net.i-dev.betterlogic" } );
let getBetterLogicVar = async (name, defaultValue) => {
try {
let x = await betterLogicApp.apiGet(name)
return x.value
} catch (error) {
log("catch");
betterLogicApp.apiPut(varName + "/" + defaultValue);
return defaultValue;
}
}
let t = await getBetterLogicVar(varName, "test");
But it does not save - and every run/test I make, the catch section is called.
What am I doing wrong?
Thanks.