Changing variable values with URL's

Hi all,

I found out that with URL’s I can modify a variable called “MyData” by performing:’

http://:3480/data_request?id=variableset&Variable=MyData&Value=125
http://:3480/data_request?id=variableget&Variable=MyData

I see that it works, but how can I use this variable “MyData” in my Lua code?

If I use
luup.log(MyData)

…the log tells me that MyData is null.

Thanks for your help in advance,
Erik

Youo’ll probably benefit form @RexbBeckett’s Conditional Scene Execution: Some Examples and the wiki, Getting started with LUUP.

Thanks for providing the links.

If been googling/reading quite a lot to find out how to manipulate variables.
With URL’s I am able to start scenes and to modify properties/settings of devices.

But it also seems to be possible to omit the DeviceNum and serviceID. Vera documentation states the following about it:
(see [url=http://wiki.micasaverde.com/index.php/Luup_Requests#variableset]http://wiki.micasaverde.com/index.php/Luup_Requests#variableset[/url])

http://ip_address:3480/data_request?id=variableset&DeviceNum=6&serviceId=urn:micasaverde-com:serviceId:DoorLock1&Variable=Status&Value=1
If you leave off the DeviceNum and serviceID, then this sets a top-level json tag called “Variable” with the value.

But how can I access that “top-level json tag called “Variable”” in my LUA script?

Thanks,
Erik

LUA Variables ARE NOT the same as JSON variables ARE NOT the same as device variables!

You can access state variabled in LUA with luup.variable_get … You can access SOME JSON variables with luup.attr_get

Ok thanks, that clears it up for me.