01.10.2018, 06:18
Use this code to get a scene object value. Create a scheduled script that runs every minute. Replace myscene with your scene name, 32/1/9 is scene object address, 32/1/11 is value status output object.
Code:
require('json')
function getsceneobjvalue(sname, addr)
local sceneid = db:getone('SELECT id FROM scenes WHERE name=?', sname)
if sceneid then
local objid = buslib.encodega(addr)
local query = 'SELECT value FROM scene_sequence WHERE scene=? AND object=?'
local value = db:getone(query, sceneid, objid)
if value then
return json.pdecode(value)
end
end
end
value = getsceneobjvalue('myscene', '32/1/9')
grp.checkwrite('32/1/11', value)