I’m increasingly reusing different scripts in projects and as some may know, it might be a tedious effort to create the different scripts and group addresses on each project.
I’m just wondering if there is a plan to create a sort of script.create function in the software in the near term?
I think the idea is clear. If you make a new visualisation for block of N buildings where all houses are the same but group addresses differs (because you use a numbering scheme) then you want to create only one visualisation and copy it N times. This tool is heavily missing at LM. What I suggested (unsuccessfully) was a set of scripts which parse the whole project to (many) Excel sheets. A system implementator can bulk modify what he wants and re-create the project back by another script.
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
16.01.2019, 06:28 (This post was last modified: 16.01.2019, 06:29 by FatMax.)
Thomas use case makes sense, but for me personally it would allow me to build one install script for repetitive functions that depends on event and resident/scheduled scripts and different group addresses that needs to be created.
It would also allow me to install functions remotely from a server and perhaps update scripts with a script.insert command.
I’m sure many users would benefit from this sort of functionality.
data = {
-- either event, resident or scheduledtype = 'event',
-- unique script namename = 'my script',
-- 1 = active, 0 = inactiveactive = 1,
-- event script: group address or tag-- resident script: sleep time in seconds (0..60)-- scheduled script: execution date/time in CRON formatparams = '1/1/1',
-- set to 1 to enable "execute on read" for event scripts-- not used for resident and scheduled scriptssubparams = 0,
-- script Lua codescript = 'log(123)',
-- optional script categorycategory = '',
-- optional script descriptiondescription = '',
}
-- check for duplicate script with the same nameexists = script.get(data.name)
ifnotexiststhendb:insert('scripting', data)
data.id = db:getlastautoid()
script.save(data, true)
script.reloadsingle(data)
end
data = {
-- either event, resident or scheduledtype = 'event',
-- unique script namename = 'my script',
-- 1 = active, 0 = inactiveactive = 1,
-- event script: group address or tag-- resident script: sleep time in seconds (0..60)-- scheduled script: execution date/time in CRON formatparams = '1/1/1',
-- set to 1 to enable "execute on read" for event scripts-- not used for resident and scheduled scriptssubparams = 0,
-- script Lua codescript = 'log(123)',
-- optional script categorycategory = '',
-- optional script descriptiondescription = '',
}
-- check for duplicate script with the same nameexists = script.get(data.name)
ifnotexiststhendb:insert('scripting', data)
data.id = db:getlastautoid()
script.save(data, true)
script.reloadsingle(data)
end
Hey guys,
how can i insert a three or four line code there ?
data = {
-- either event, resident or scheduledtype = 'event',
-- unique script namename = 'my script',
-- 1 = active, 0 = inactiveactive = 1,
-- event script: group address or tag-- resident script: sleep time in seconds (0..60)-- scheduled script: execution date/time in CRON formatparams = '1/1/1',
-- set to 1 to enable "execute on read" for event scripts-- not used for resident and scheduled scriptssubparams = 0,
-- script Lua codescript = 'log(123)',
-- optional script categorycategory = '',
-- optional script descriptiondescription = '',
}
-- check for duplicate script with the same nameexists = script.get(data.name)
ifnotexiststhendb:insert('scripting', data)
data.id = db:getlastautoid()
script.save(data, true)
script.reloadsingle(data)
end
Hi,
I am using this for for 'autosetup' LM with a startup (init) script and it has been very useful.
Is there any simular way to add functions to 'common functions' (or overwrite the file) ?
15.09.2023, 12:46 (This post was last modified: 15.09.2023, 13:14 by FatMax.)
Thank you again for the great help. Is this web request library documented anywhere? I would like to also create new Modbus-profiles and this would be very helpful.