Homey Community Forum

[APP] Better logic / Variable management (v1.0.4)

You need to type the variable names. Using the tags it gives the values of the tags so I dont know which ones have changed.

Thanks. Problem solved. Typing the variables was the solution. Call me stupid :crazy_face:

I added a hint in the latest version (1.0.4) that tags will not work :slight_smile:

Would it be possible to move the “delete all” button. This button is placed directly under the “add variable” button and on a phone the delete button is touched easily. Instead of adding you will delete all variables.


Which mathematical operators can be used?
Are this only +,-,/,*?
Or can logarithm and exponentiation functions also be used?

any mathjs operators will work

Just note something may have changed: I had to use {{ and }} around the expression in the “Set a variable” card.


First love this system, works very well.

I do have an issue I havent solved which is rounding to a half number.
For example I want 22.3 to be rounded to 22.5 instead of 22 or 23.

Tried some different methods but this mathjs dosent seem to support things like ceiling/ceil(number, 0.5), round10, ceil10 etc.

Is this possible today?

Try round(x*2)/2

1 Like

Thank you, worked

Any way to split a variable and only keep one part?

Ex variable contains:
“Homey Blog

Can I split it and only keep the webadress?

Hi there, is there any manual or step by step explanation of how to use better logic? I like to build a string with a variable #YYYY and #MM #DD of the current day in it to create a string to stream the dutch news (20.00 nos journaal) to chromecast but tried and could not solve this myself. So what I want is https://download.omroep.nl/nos/content/mp4/web02/2019/08/29/43866/mp4_web02.mp4
where I replace the date with a vriable. But a general manual on how it works would even be greater as I see lots of possibilities for it (like triggers, etc).

Ha discovered myself how it works (with the function mathjs expression and then dollar sign $ # YYYY $ in it for the year) somehow $ disappear in this forum. Now I come to the next challenge. Via IFTT and an RSS feed I retrieve a string containing a unique number for the mp4 of that journal. https://nos.nl/b/43885 now I want to get that number from this string so need to remove a part of the string (https://nos.nl/b/). Again a manual or some help is welcome. I will then share my project with the NOS chromecast feed app that no longer works.

Hi, how have you been able to use the time in an expression? I am trying to copy time (#HH and #mm) into 2 separate variables. However, the variables change to empty

Any help will be apreciated

You have to use dollar sign. hope it works

Don’t know what I did wrong, but now it is working. Thannks very much for the fast response!

Hello everybody,

I am setting the BL string var in homeyScript, but it does not work due to “/” char.

console.log gives:

but the BL variable RandomMusicURL is not updated.

I found out that all works as expected when removing “/” sign from the string. But / is not an escape char, so what’s wrong here?

I am also looking for the answer to that question. Do you already know it?

Or maybe somebody else?

let BLApp = await Homey.apps.getApp({id:“net.i-dev.betterlogic” });
BLApp.apiPut(‘Klok12h/’ + theHour);

Great app, would like to see a figure at the number slide device?