waaren wrote: ↑Monday 17 September 2018 22:56
Not quite sure I understand your question.
Do you mean domoticz variables or variables from dzVents persistent data or something else?
In short what I am planning to do: I´d like to change the time of my WakeUpLight on multiple places. MySensors, here in Domoticz event manager, later on Raspi, tasker at my phone and so on.
So i´d like to have a variable to store the time, which I can read, update and so on.
Some of my variables are global (f.e. CT and brightness), located in domoticz/scripts/dzVents/scripts/global_data.lua
I can read and manipulate them perfectly within execute = function...
but if I try to replace
with
Code: Select all
active = domoticz.globalData.myVar
while myVar = 'true', I get the error it has a nil value. Also havent found a way to convert String to boolean in Lua or something like this.
same with
Code: Select all
timer = { domoticz.globalData.myVar }
, I can not just set the variable to 'at 6:30'
log always says:
Code: Select all
attempt to index field 'globalData' (a nil value)
and
Code: Select all
timer = { 'domoticz.globalData.myVar' }
simply does not get executed.
Would be perfect if I could get that to work.
For the case it is not possible:
I have checked other options. Easiest seemed to be a text dummy. With your hint I got
Code: Select all
active = function(domoticz)
return domoticz.devices('Texttest').text == os.date("%H")
end,
running
Strangely,
Code: Select all
active = true,
on ={
timer = function(domoticz)
return domoticz.devices('Texttest').text == os.date("%H")
end,
},
does _not_ run a single time. As the wiki says, timer = should be triggered every minute. "active = " runs fine while "timer =" using same function call was not executed a single time within ~30 minutes.