29.05.2023, 10:33
This is the script that loads 40%
Code:
local inputgroup = {}
local groupobjects = {}
function readAndSetTemperature(group, j)
local base = group .. '/'
local readAddress = base .. '0/15'
local setAddress = base .. '4/' .. j
local temperature = grp.getvalue(readAddress)
if temperature ~= nil then
grp.checkwrite(setAddress, temperature)
end
end
client = require('localbus').new(0.1)
for i = 0, 60 do
local group = i
groupobjects[group] = {}
local controlCheck = group .. '/0/11'
local controlValue = grp.getvalue(controlCheck)
local zeroCheck = group .. '/0/13'
local zeroValue = grp.getvalue(zeroCheck)
for j = 13, 113, 10 do
local addr = group .. '/4/' .. j
local value = grp.getvalue(addr)
if zeroValue == false or controlValue == false then
grp.checkwrite(addr, 0)
elseif value ~= nil then
inputgroup[addr] = group
groupobjects[group][addr] = value
end
end
end
while true do
for i = 0, 60 do
local group = i
local controlCheck = group .. '/0/11'
local controlValue = grp.getvalue(controlCheck)
local zeroCheck = group .. '/0/13'
local zeroValue = grp.getvalue(zeroCheck)
if zeroValue == false or controlValue == true then
for j = 17, 117, 10 do
local addr = group .. '/4/' .. j
grp.checkwrite(addr, 0)
end
else
for j = 17, 117, 10 do
readAndSetTemperature(group, j)
end
end
end
client:loop(1)
end