Logic Machine Forum
Scene Setting and Storing - 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: Scene Setting and Storing (/showthread.php?tid=1506)



Scene Setting and Storing - sjfp - 29.07.2018

Hi I have a project with 70 plus lighting circuits. So going to split the Visualization into 3zones.
So in each zone we will have 6 scenes that can be independently set. And 6 global scenes that will trigger the same scene in each zone. So if Global scene “cleaning” is pressed then “cleaning” in the zones will be selected / recalled.

I also want to be able to modify scenes, only in the zone pages. I would will to recall a scene with a normal button press but be able to store the current levels by holding the same button for more than a second. (Long Press). 

Any advise on the best approach / or an example would be greatly appreciated.
Need to get the project moving. But been thinking of how to achieve the above effectively.
 
Thanks for any comments


RE: Scene Setting and Storing - Daniel - 30.07.2018

Hi
Long press functionality you can find here https://forum.logicmachine.net/showthread.php?tid=275&pid=1238#pid1238

To save scene live values just use this command scene.savelive(name) where name is your scene name.

BR


RE: Scene Setting and Storing - gdimaria - 27.09.2018

Hi,

I would need to display the value of a certain sequence of a given scene on an object.

Is it possible?

Tnx


Peppe


RE: Scene Setting and Storing - admin - 28.09.2018

Do you want just to display it or to have an option to modify it as well?


RE: Scene Setting and Storing - gdimaria - 28.09.2018

by now just to display could be enough, but to have an option to modify it as well would be the best!


RE: Scene Setting and Storing - admin - 01.10.2018

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)