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.

Create and save light scenes by customer
#1
Hi,

seen somewhere at forum but not possible to find..

I need create possiblity change dimming level of different lamps by user and than save it like scenario.. Customer wants to have at least possibility to create by themselves at least 4 scenaries and save it for future selection.

Need advice how to create such solution.

BR,

Alex
Reply
#2
User can edit and save existing scene, he can't really make new one. We are adding such functionality to Mosaic right now.
------------------------------
Ctrl+F5
Reply
#3
Hi Daniel,

big thanks for info, but I could't find script seen here before. With it customer can press somenthing like "learn" key at visu, select different light level for lightting devices and "save" all setting as scene 1. Save different light levels for scene 2...etc. And later just select scene name or number to switch on previously saved settings.

This is not like scene programming in our devices, this is with script I want find Smile

Alex
Reply
#4
(19.12.2019, 07:01)AlexLV Wrote: Hi Daniel,

big thanks for info, but I could't find script seen here before. With it customer can press somenthing like "learn" key at visu, select different light level for lightting devices and "save" all setting as scene 1. Save different light levels for scene 2...etc. And later just select scene name or number to switch on previously saved settings.

This is not like scene programming in our devices, this is with script I want find Smile

Alex

If you're using KNX devices, than you can just send value 128 + N to scene group address, where N - is 0..64 scene number
Reply
#5
Hi
You can make an interface where user can select values for a scene and then you can save it via such command scene.savelive(name)
Smart way it would be to save scene on long press of the scene button.
BR
------------------------------
Ctrl+F5
Reply
#6
Wow,

big thanks, may be it will be easier than I saw script solution before.

Thank you for information.
Reply
#7
Hi Again,

finally I found solution I mentioned Smile It described on russian, below will translate it to English.

Link:  http://logicmachine.net.ru/solutions/sve...zovatelem/

Script itself:

Code:
function scene_manager(event)
  -- получаем имя переменной, она является именем сценария - receiving name of variable, it will be name of scenario
  name_scenario = grp.alias(event.dst)

  -- определяемся находимся ли мы в режиме обучения - checking, is learning mode switched on or not
  is_learn_mode = grp.getvalue('learn_mode')

  -- если переменная определена в системе - if  this variable existing in system
  if(is_learn_mode ~= nil) then
      -- включен режим обучения, записываем в память - and learning mode is on than saving to memory
      if(is_learn_mode == true) then
          -- сохраняем массив в память под именем переменной сценария --saving array to memory under variable - scenario's name
          -- получаем все объекты системы с меткой 'light' -- receiving all objects with tag "light"
          lights = grp.tag('light')
          -- сохраняем список объектов и --saving list of objects and it's statuses under scenario variable
          -- их состояния под именем переменной сценария
          storage.set(name_scenario, lights)
      else
          -- иначе считываем массив из памяти  -- or reading array from memory
      lights = storage.get(name_scenario, 'no data')

          -- и устанавливаем в цикле значения по имени объекта -- and setting in cycle values by object's names
          -- для установки по групповому адресу нужно использовать -- for group addresses usage
          -- light.address вместо light.name -- use light.address instead light.name

      if type(lights) == 'string' then
        alert('No data')
      end
      log (type(lights))
      if type(lights) == 'table' then

          for index, light in ipairs(lights) do
          log(light.name, light.data)
              grp.write(light.name, light.data)
          end

      end
    end
  end

end


full page translated below:

logicmachine.net.ru Technical solutions at LogicMachine User Editable Light Scenarios
User Editable Light Scenarios

Purpose: To create the ability for the user to change predefined light scenes by himself using visualization on an iPad or computer.

Hardware requirements : a solution can only be implemented using the freely programmable LogicMachine controller.

Solution: We determine the group addresses that will participate in the script. For them we define tags (tags) " light ". We determine the group addresses that will be responsible for the scripts. It is important to give meaningful names to the variables corresponding to these addresses (Scene_1, Scene_2 and so on).

To switch the system from the script learning mode to the script display mode, we determine the group address in which information about the system status will be stored. Name the variable learn_mode. It is important that the variable type is binary (boolean).

For each group address selected as a button handler (Scene 1, Scene 2, etc.), create a script in Scripts -> Event-based (Scripts -> Event-based).

We add one entry to each script:

scene_manager (event)

Here, a function common to all scripts is called, which is used to create or execute a script, where a structure containing information about the event source is passed through the event parameter. Next, in the Scripts -> General functions (Scripts -> Common functions) we write the following script, where we define this function.
Source

  function scene_manager ( event )
  - get the name of the variable, it is the name of the script
  name_scenario = grp.alias ( event.dst )

  - determine whether we are in training mode
  is_learn_mode = grp.getvalue ( 'learn_mode' )

  - if the variable is defined in the system
  if ( is_learn_mode ~ = nil ) then
      - learning mode is on, write to memory
      if ( is_learn_mode == true ) then
          - save the array in memory under the name of the script variable
          - we get all the objects of the system labeled 'light'
          lights = grp.tag ( 'light' )
          - save the list of objects and
          - their state under the name of the script variable
          storage.set ( name_scenario, lights )
      else
          - otherwise, read the array from memory
      lights = storage.get ( name_scenario, 'no data' )

          - and set the values in the loop by the name of the object
          - to install at a group address you need to use
          - light.address instead of light.name

      if type ( lights ) == 'string' then
        alert ( 'No data' )
      end
      log ( type ( lights ) )
      if type ( lights ) == 'table' then

          for index, light in ipairs ( lights ) do
          log ( light.name, light.data )
              grp.  write ( light.name, light.data )
          end

      end
    end
  end

end

The principle of the script :

    We get the script name from the function parameters - event.dst.
    We determine the mode of operation of the system. If the learn_mode variable is 1, then the learning mode is on and writing to the script occurs, if the variable is 0, then the learning mode is off and scripts will be launched.
    If the record, then we get all the objects of the system that have the tag (tag) "light" and save it under the name of the script.
    If the launch, then by the name of the script load the list of objects, and send commands to the system according to the loaded list of objects.

Using the script: After all group addresses and scripts are installed, the display of objects participating in the scripts, the script call buttons and the learning mode enable button can be displayed in any visualization system, such as built-in EVIKA LogicMachine, as well as any other such as iRidium Mobile. Moreover, you can do without visualization at all by linking these addresses to really existing switches or touch panels.

To record scripts, the user turns on the 'learn_mode' object, and after that selects which fixtures should be turned on, which ones are turned off and clicks on the script button. Writes a sequence of objects to memory. After disables the object 'learn_mode'. Now when you click on the script button, the script starts.

Alex
Reply
#8
(18.12.2019, 13:49)Daniel. Wrote: User can edit and save existing scene, he can't really make new one.  We are adding such functionality to Mosaic right now.

Hello,

has been this functionality added yet?
Reply
#9
You can see it in Mosaic Beta but I wouldn't use it for a project yet
------------------------------
Ctrl+F5
Reply


Forum Jump: