how to extract all lua coding from vera unit

It there a easy way to copy/backup all my personal lua code which i use in scenes?

I have the tool zerobrane studio where i can script/program and test.

I am looking for an easy way to extract all my scenes from my current vera unit to my pc where i can store it and work offline to change/modify them but also to backup them.

I now do a copy paste from the UI5 into a empty file but this does not work easily.

So is there a way to connect to the vera unit and read all scenes/lua code direct and also backup them?

The complete scene code (including Lua) is returned by the user_data HTTP request under the “scenes” tag.

You can also get the startup Lua code too.

thx

but how can i get this easily locally saved?

You can get the User data from:

http://ip_address:3480/data_request?id=user_data

Search for LUA

this is not my own lua code, just json output

I mean the code i entered myself in the scenes in the luup tab

And then ALL code from ALL scenes i entered, i now have about 20 scenes and scenes can be triggered (with own luup code) or sheduled.

I search a way to get all the scenes to my local pc including the code i made myself, i mean the exact code as is vissible in the UI or zerobrane editor

It’s in there!

ok, but that is not what i seek

I seek the 1on1 copy/code of what is in the UI visible so i can use it in an editor

I seek only my own lua code which is saved somewhere on the vera unit…

It’s in there, verbatim, under the ‘lua’ tag of each scene.

In fact, here’s a bit of code which prints out the bits you need (it can run directly in Rex Beckett’s LuaTest window)

local _,x = luup.inet.wget "http://127.0.0.1:3480/data_request?id=user_data2"

local json = require "dkjson"

local j = json.decode (x)

print ""
print "-- Startup Lua:"
print (j.StartupCode)

print "-- Scene Lua"
for _,s in pairs(j.scenes) do
  if s.lua then
    print ("--",s.name) 
    print (s.lua)
  end
end

Works for me.

Looks like the user_data request includes all the LUA you can specify via the GUI. If you happen to load LUA directly on to the Vera (i.e. uploading by hand) it will not be included here.

If you are not afraid of SSH then you can peek into /etc/cmh-ludl and pull all the LUA out of there. Most of the files are LZO compressed so you will need to decompress them before you can read them.

You can access them most easily (decompressed) through the Luup files page under the Apps > Develop Apps tab of the UI.

As akbooer states, use Rex Beckett’s LuaTest http://forum.micasaverde.com/index.php/topic,24018.0.html