Logic Machine Forum
Script function with new FW - 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: Script function with new FW (/showthread.php?tid=2641)



Script function with new FW - Rauschentofft - 13.05.2020

Hi.

This script stopped working after new FW 2.4.0 update in homeLYnk.

Can anybody check the function of the script? 

Or maybe it is some thing else, but it worked before the update.



value = event.getvalue()

-- Set maximum light value when generator is active
Max_Value = 20

-- Execute only when event (this script is attached to object 32/3/1) is true
if event.getvalue() == true then
  -- Create empty table
  Store_Values = {}
  -- Loop through all objects with tag 'RESKRAFT'
  for _, myobject in ipairs(grp.tag('RESKRAFT')) do
    -- Check if current loop item has value greater then Max_Value
    if myobject.value > Max_Value then
      -- Add current object including value to table
      table.insert(Store_Values, myobject)
      -- Write new value to bus
      grp.write(myobject.address, Max_Value)
    end
  end
  -- Write new values to storage if any item is added
  if #Store_Values > 0 then
    storage.set('Generator_Active_Values', Store_Values)
end
else
  -- Get data from storage
  mydata = storage.get('Generator_Active_Values')
  -- Check if old values data was available in storage
  if mydata ~= nil then
    -- Loop through all objects from storage to set back to old values
    for _, myobject in ipairs(mydata) do
      -- Write stored value to KNX
      grp.write(myobject.address,myobject.data)
    end
      -- Delete storage values from storage
      storage.delete('Generator_Active_Values')
  end
end


RE: Script function with new FW - admin - 14.05.2020

Add some log() calls to the script to check what's going on. The script itself looks correct.