Logic Machine Forum
Export objects / GA - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Export objects / GA (/showthread.php?tid=5798)



Export objects / GA - pioneersteffen - 20.12.2024

Hi @all,

is there any way to export all objects/ GA in a file type that can we reimported later on?

I need to roll back to a month old controller backup and in the meantime I created many new virtual objects and I need to import them after roll back.

Many thanks for your help.

Best regards 
Steffen


RE: Export objects / GA - admin - 20.12.2024

Install LM Sync app.


RE: Export objects / GA - pioneersteffen - 20.12.2024

Many thanks for the quick reply. Are there any other options? I have no internet access onside to connect to App Store.


RE: Export objects / GA - Erwin van der Zwart - 21.12.2024

Old fashion script (:

Code:
--Export to FTP
objects_table = db:getall('SELECT * FROM objects')
jsonstring = require('json').encode(objects_table)
io.writefile('/www/user/objects.txt', jsonstring)
script.disable(_SCRIPTNAME)

Copy objects.txt from Apps FTP user folder to your other controller

Code:
--Import from FTP
objectstring = io.readfile('/www/user/objects.txt')
newobjects_table = require('json').pdecode(objectstring)
for _, object in ipairs(newobjects_table) do
  exist = grp.alias(object.name)
  if exist == nil then
    objectaddress = knxlib.decodega(object.address)
    grp.create({
      address = objectaddress,
      name = object.name,
      datatype = object.datatype,
      comment = object.comment,
      units = object.units,
      tags = object.tagcache,
      enums = object.enums,
      visparams = object.visparams,
    })
  end
end
script.disable(_SCRIPTNAME)



RE: Export objects / GA - pioneersteffen - 21.12.2024

Many thanks for the brilliant help as always!