Page 1 of 1
uservariables_lastupdate NIL
Posted: Saturday 20 March 2021 11:19
by binbo
Hi all,
I thought this would be easy - but I am having a real problem with it...
Code: Select all
s = uservariables_lastupdate['oneSMS'];
if (s ~= nil) then
print("UPDATED")
end
uservariables['oneSMS'] = 'set';
print("SET VALUE")
In my log i NEVER get UPDATED.
I am setting the value of "oneSMS" - why does the lastupdate never get set?
Re: uservariables_lastupdate NIL
Posted: Saturday 20 March 2021 12:02
by waaren
binbo wrote: ↑Saturday 20 March 2021 11:19
I am setting the value of "oneSMS" - why does the lastupdate never get set?
What do you see when you use below Lua?
Code: Select all
commandArray = {}
-- loop through all the changed variables
for variableName, variableValue in pairs(uservariables) do
print( string.format("%-30s %1s %-20s %20s" ,variableName:sub(1,30) ,':' ,tostring(variableValue):sub(1,20), ' ==>> ' .. tostring(uservariables_lastupdate[variableName]) ) )
end
return commandArray
Re: uservariables_lastupdate NIL
Posted: Saturday 20 March 2021 12:27
by binbo
I see this...
Code: Select all
floodsWork : 1 ==>> 2020-01-26 17:06:17
The trigger is set to "Device"
I am essentially trying to set a variable with the current time.
Then check to see if 30secs have passed since it was set.
As my 433mhz beam detectors receive 10 or so responses, and my script is sending me 10 sms messages. I want to limit it to 1 message.
Thanks for the help!
Re: uservariables_lastupdate NIL
Posted: Saturday 20 March 2021 12:48
by binbo
SORRY!
I didn't know you had to create the user variable in setup > more options > user variables
Before you could use them!

Re: uservariables_lastupdate NIL
Posted: Saturday 20 March 2021 12:51
by waaren
binbo wrote: ↑Saturday 20 March 2021 12:27
As my 433mhz beam detectors receive 10 or so responses, and my script is sending me 10 sms messages. I want to limit it to 1 message.
Seems you only configured one uservariable in domoticz and it is not 'oneSMS'
Please share your complete script. That will make it much easier to help you.