Variable_Get Function not Returning Expected Value

Hi,

I’m not new to programming but new to LUA. I’ve successfully used the luup.is_night function to have lights turn on when a door is opened only at night which was a pretty simple task. Now I’m moving toward more complex conditional functions and would like a light to turn on only if another light is off when a door is opened. I have a simple if statement but no matter what values I use, the if statement never resolves to true, only executing the else code. Here is an example:

local switch = luup.variable_get(“urn:schemas-upnp-org:device:BinaryLight:1”, “Status”, 17)
if (switch==“0”) then
return true
else
return false
end

The device above is a GE/Jasco wall switch 45609.

I have tried the comparator as a value and “text” and neither resolve to a 1 or a 0. Is looks like there is some other data that is coming back from the luup.variable_get function that I am not checking for. All the reading I have done indicates this should work but I’m just not having any success. Any help would be greatly appreciated.

Thanks!

Previous examples of the same error:
http://forum.micasaverde.com/index.php?topic=8980.0
http://forum.micasaverde.com/index.php/topic,4508.msg58597.html#msg58597
http://forum.micasaverde.com/index.php?topic=6375.0
http://forum.micasaverde.com/index.php?topic=12011.0
http://forum.micasaverde.com/index.php?topic=9414.0

Pay particular attention to the term “service ID”, which your “schemas” string is not.

You can get the CORRECT serviceID by find the Variable in the ADVANCED Tab of the device you are interacting with.
Let you mouse HOVER over the name. A popup will display the CORRECT serviceID for that particular value.

NOTE: Check each variable … many variables in the same device have DIFFERENT serviceIDs

That did the trick. Seems that I looked into everything else except that.

Thanks futzle and Richard. I’m off to the races now.