Thanks for the hint about testing for “nil”, Rex. That helped with the second part of the problem I was having. I was trying to determine the status of a countdown timer, but was again having logic errors, i.e. was always false. (I’m using my variable container to see what values are being generated by my luup.variable_get(…) commands). But once I tested for nil, I found that the command was returning a nil value, though I couldn’t see anything wrong with the command syntax. So, I just decided to erase and retype the luup.variable_get(…) statement and… viola! Worked properly. Must have had a ghost character or something in there.
Below is the luup I used to test for nil or working command syntax in case anyone is wondering… It’s written in the LUUP tab of a scene named “Step Test” that sits on the UI5 screen next to the countdown timer and the variable container, so that I can see the results in real time. It tells me the variable value (in this case, whether the countdown timer is counting or not) and whether or not the luup.variable_get(…) statement is working, or if it generated a nil value. The variable container allows me to see the information without having to check log files.
[code]local dID1 = 54 – Variable Container 1
local dID3 = 69 – Countdown Timer
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable1”,“–”,dID1)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable2”,“–”,dID1)
local counterstatus = luup.variable_get(“urn:futzle-com:serviceId:CountdownTimer1”,“Counting”,dID3)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable1”,counterstatus,dID1)
if counterstatus == nil then
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable2”,“nil”,dID1)
else
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable2”,“working”,dID1)
end[/code]