Page 1 of 1
Change local variable from other script
Posted: Saturday 22 June 2019 22:32
by poudenes
Hi ALl,
I use several local variables in some dzVent Scripts. Is it possible to change those local variables from outside the script itself?
Cheers
Peter
Re: Change local variable from other script
Posted: Saturday 22 June 2019 22:46
by waaren
poudenes wrote: Saturday 22 June 2019 22:32
I use several local variables in some dzVent Scripts. Is it possible to change those local variables from outside the script itself?
No.
dzVents has global_data.lua to handles these kind of requirements. You could also store your values in a domoticz uservariable or in various fields in devices. (description field in most devices, text field in text-device, etc..)
Re: Change local variable from other script [Solved]
Posted: Saturday 22 June 2019 22:49
by poudenes
Yes, I used it before in uservariable. Now put those in the scripts itself. Easier to handle. (ok till now because of this question)
I will take a look to add them in global_data.
Thanks for aswering

Re: Change local variable from other script
Posted: Sunday 23 June 2019 17:02
by poudenes
Solved:
Added this in global_data:
Code: Select all
data = {
LuxEvening = { initial = 0 },
LuxMorning = { initial = 0 },
HomePeter = { initial = 0 },
HomeKay = { initial = 0 },
KodiPlayVar = { initial = 0 },
KodiStopVar = { initial = 0 }
},
And then I can access the data in script with:
Code: Select all
if (domoticz.globalData.KodiPlayVar == 0) then
domoticz.globalData.KodiPlayVar = 1
end
Now I can read the variables from other scripts
