13.05.2020, 20:29
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
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