Can't save betterlogic variable from Homeyscript

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) {


    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?


log("catch", error)

Sorry I have not been clear enough.

The catch section is not the problem since I expect the apiGet to fail cause there is no variables called “MyVar” yet.

My problem is that the apiPut is not storing the variable.

Looking at the app code, you can only update existing variables, otherwise the API returns an error.