Hi,
I am writing a script to set my screens on a certain percentage. Therefore I need to set/read the new 2.0 logic variables from Homey Script.
Does anybody know how to do this?
Kind regards,
Marcel
Hi,
I am writing a script to set my screens on a certain percentage. Therefore I need to set/read the new 2.0 logic variables from Homey Script.
Does anybody know how to do this?
Kind regards,
Marcel
Thanks!
Found this from google search and this is how I got variables to update:
const variables = await Homey.logic.getVariables()
console.log('variables', variables)
const id = "2df501f3-f1d7-4f40-bbba-6a8e29b51fee" // my variable id
const dimLevel = await Homey.logic.getVariable({id: id})
const newLevel = dimLevel.value > 0.2 ? dimLevel.value - 0.2 : 0
await Homey.logic.updateVariable({id: dimLevel.id, variable: {value: newLevel}})