04.04.2019, 12:38
(03.04.2019, 07:49)admin Wrote: Here's a function you can use. Scene name which values you want to modify must be unique for it to work correctly.
Code:function setscenevalues(name, values)
local json = require('json')
local sceneid = db:getone('SELECT id FROM scenes WHERE name=?', name)
sceneid = tonumber(sceneid)
if not sceneid then
return nil, 'scene not found'
end
for addr, value in pairs(values) do
local ga = buslib.encodega(addr)
local update = { value = json.encode(value) }
local where = { scene = sceneid, object = ga }
db:update('scene_sequence', update, where)
end
scene.reload()
return true
end
name = 'my scene name'
values = {
['32/1/1'] = 1,
['32/1/2'] = 2,
['32/1/3'] = 3,
}
res, err = setscenevalues(name, values)
log(res, err)
Thank you for the script works great, how can I add the ramp rate like 4seconds or 8 seconds to the level