where to store data and read it later?

Is there a way to store data from my vera and use it later?

For example, i activate a device and which to store the timestamp and status of a sensor at the time the device was activated.
I retrieve all the data i want to have using lua code but i have no option to store it for later use…

So how can i store the data and use it again on a later time/date…

If the unit run on PHP i would use a mysql database to store it, but in lua i have no idea how to save data or how even to connect to a mysql database if it is possible.

Who can advise/help?

You can use:
luup.variable_get

and
luup.variable_set

to get/save variables. These will be saved persistantly.

See:
http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_variable_set

Variables are uniquely identified on Vera by the following three attributes:
DeviceID (This is a number for existing Device in Vera)
ServiceID (This is a string)
VariableName (This is a string)

Make up your own Service ID … i.e. your name … use the same ServiceID for all of your variables.
Make up your variable Name … they should describe the purpose of the variable.
You must device which deviceID(s) to place the variables.

You can’t delete a variable once you create it with luup.variable_set.

ok clear, but what deviceID should i use then?

I tried it allready with an existing ID, result that ID did not function anymore…

Is it not possible to create a virtual ID, for example:
Deviceid = 180 (this id is now my database for lua)
serviceID = a name
VarialName = belong to serviceID

So how do i create a deviceID which i can use for all my data?

You have to use an existing Device … you can’t make one … actually you can … create a Virtual Switch or Multi-Switch or Any plugin … and use it’s deviceID