Schlage lock status through LUA

Does anyone know if this string of code will return the current or last polled state of a Schlage deadbolt lock???
local lockState = luup.variable_get (“urn:micasaverde-com:serviceId:DoorLock1”, “Status”, ?whatever my device ID is?)

Whenever I try to invoke the Getstatus commend through a web browser it returns an error “service/action not available”. I’m thinking that maybe the status is only available when polled.

Yes that should work. You can check it from your browser using this:

http://ip_address:3480/data_request?id=variableget&DeviceNum=123&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=Status

Where ip_address is the IP address of your Vera and 123 is the device number of your lock.

[quote=“RexBeckett, post:2, topic:187422”]Yes that should work. You can check it from your browser using this:

http://ip_address:3480/data_request?id=variableget&DeviceNum=123&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=Status

Where ip_address is the IP address of your Vera and 123 is the device number of your lock.[/quote]

Thanks Rex, I’m new to LUA and LUUP, trying to learn the the syntax and methods and correct idiology of the language. Doesn’t seem very difficult. I already write programs in Python, but I’m also diving into Arduino and C programming.

You may find LuaTest helpful for checking your Lua code. It provides more-useful error messages, allows the contents of variables to be displayed using print(…) statements and can list the Luup variables and actions for your devices.

I’ll check it out when I get home. Followed the link and read about it. Sounds like a great tool to test for LUUP scene creation and plug-in development :smiley:

LuaTest works well for scene code and can help debug code chunks for plugins. The best tool for debugging whole plugins is ZeroBrane Studio for Vera although there is a one-time licence fee.

Very nice!!!..Not badly priced for what you get. I was thinking about using a LUA IDE, but this IDE seems to cover more ground when it comes to Vera development. Thanks again for the suggestion!!! Cuts a lot of the headache out when debugging. ;D