uservariables_lastupdate NIL Topic is solved

Moderator: leecollings

Post Reply
binbo
Posts: 50
Joined: Sunday 18 June 2017 21:47
Target OS: -
Domoticz version:
Contact:

uservariables_lastupdate NIL

Post 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?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: uservariables_lastupdate NIL

Post 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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
binbo
Posts: 50
Joined: Sunday 18 June 2017 21:47
Target OS: -
Domoticz version:
Contact:

Re: uservariables_lastupdate NIL

Post 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!
binbo
Posts: 50
Joined: Sunday 18 June 2017 21:47
Target OS: -
Domoticz version:
Contact:

Re: uservariables_lastupdate NIL

Post 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! :roll:
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: uservariables_lastupdate NIL

Post 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.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest