04.01.2024, 13:57
Happy New Year to all,
I am trying to implement a heart bit that I use to send to some modbus servers in order to take appropriate action by their side if communication is lost.
I have setup the following simple event script:
GA '31/7/1' is the trigger bit which I initiate every minute buy a scheduled script in case something goes wrong.
The monitor of heart bit at modbus slave site is shorter than a minute so I can not use a scheduled script for that purpose.
Initially script works but after some time it runs continuously not taking into account os.sleep function.
What am I doing wrong.
Thanks in advance!
I am trying to implement a heart bit that I use to send to some modbus servers in order to take appropriate action by their side if communication is lost.
I have setup the following simple event script:
Code:
value = event.getvalue()
log('start value : ' .. tostring(value) )
os.sleep(10.0)
value1 = not value
grp.write('31/7/1', value1)
grp.write('1/1/255', value1)
grp.write('2/1/255', value1)
grp.write('3/1/255', value1)
grp.write('4/1/255', value1)
grp.write('5/1/255', value1)
grp.write('6/1/255', value1)
grp.write('7/1/255', value1)
grp.write('8/1/255', value1)
grp.write('9/1/255', value1)
grp.write('11/1/255', value1)
grp.write('12/1/255', value1)
grp.write('13/1/255', value1)
grp.write('14/1/255', value1)
grp.write('15/1/255', value1)
log('new value : ' .. tostring(value1) )
GA '31/7/1' is the trigger bit which I initiate every minute buy a scheduled script in case something goes wrong.
The monitor of heart bit at modbus slave site is shorter than a minute so I can not use a scheduled script for that purpose.
Initially script works but after some time it runs continuously not taking into account os.sleep function.
What am I doing wrong.
Thanks in advance!