This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Scene Setting and Storing
#6
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)
Reply


Messages In This Thread
Scene Setting and Storing - by sjfp - 29.07.2018, 20:10
RE: Scene Setting and Storing - by Daniel - 30.07.2018, 08:24
RE: Scene Setting and Storing - by gdimaria - 27.09.2018, 13:50
RE: Scene Setting and Storing - by admin - 28.09.2018, 12:04
RE: Scene Setting and Storing - by gdimaria - 28.09.2018, 13:09
RE: Scene Setting and Storing - by admin - 01.10.2018, 06:18

Forum Jump: