10.03.2018, 17:31
(10.03.2018, 17:16)buuuudzik Wrote:(10.03.2018, 17:14)Domoticatorino Wrote: It is a Schneider HL 2.0.1
I mean updated version of above script I've adjusted it to be more universal, added new variables:
Code:valveStatesTag = 'circulation_pump'
pumpGA = '1/1/10'
openingValveTime = 300 -- time for fully open the valve (maximum time for next calculation)
minInterval = 30 -- minimum offset for next calculation
opened, firstTimestamp = false, 0
valveStates = grp.tag(valveStatesTag)
for v = 1, #valveStates, 1 do
valveState = valveStates[v]
if valveState.value then
opened = true
if firstTimestamp > 0 then
if firstTimestamp > valveState.updatetime then firstTimestamp = valveState.updatetime end
else
firstTimestamp = valveState.updatetime
end
end
end
if opened then
fullyOpened = (os.microtime() - firstTimestamp) >= openingValveTime
if fullyOpened then
grp.checkwrite(pumpGA, true)
nextCalculationAfter = minInterval
else
grp.checkwrite(pumpGA, false)
nextCalculationAfter = openingValveTime + 1 - (os.microtime() - firstTimestamp) -- run a little after possible change
end
else
grp.checkwrite(pumpGA, false)
nextCalculationAfter = openingValveTime + 1
end
log('Next calculation after: ' .. nextCalculationAfter .. 's.')
os.sleep(nextCalculationAfter)
No, it does not work.
there is not any mistake and any error log. Is there the opportunity to have a debug for lua?