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.

Script function with new FW
#1
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
Reply
#2
Add some log() calls to the script to check what's going on. The script itself looks correct.
Reply


Forum Jump: