Homey Community Forum

Better logic with homeyscript

hi
can someone post a homeyscript with getting/ setting better logic variables please.

Try to set a value via homescript, no error, but variabe is not set:
setTagValue('test',{type: 'number',title:'title'}, 10);

Next set the variable via app->betterlogic
Try to update variable in a flow. Error: Parameter is broken.

Any idea or example how to set / get variables with better logic?
Do I have always to set inital Variable?

I’m not so into better logic yet since built in logic works great for me so far. Homeys own API works nice for crud operations in logic variables.

hey @Ludwig_Hallgren i would use homey logic also, I just need to be able to set variables from inside homescript not via a flow.
is this somehow possible?

for me as a reminder: https://forum.athom.com/discussion/4541/ok-homey-whats-the-current-day-number
to test again

@adem_p yes that is very easily done. Look at the thread I linked at the last 4-5 comments.

For what I know it is not possible to change values of tags/variables of other apps.
That could/would give inconsistent results as not all apps are prepared for that.
Since the last update it is possible for set the Homey’s global variables.
Beside that HomeyScript has its own variables.

let sys = await Homey.system.getInfo();
var theTime = new Date(sys.date);
var theHour = theTime.getHours();
if (theHour > 12) { theHour = theHour - 12};
let BLApp = await Homey.apps.getApp({id:“net.i-dev.betterlogic” });
BLApp.apiPut(‘Klok12h/’ + theHour);

I tried that also, but had some issues with homeyscript.
a) some of the scripts disappear/deleted. after adding a new test script.
b) parameter wrong message disappeared after restarting homey.

but nevermind thank you @JPe4619 and @Dijker for your example and clearance