11.09.2020, 08:40
Scripts looks ok. How is it set up, as a scheduled script which runs every minute?
It can be written a bit shorter like this, logs might help you to find out why it's not working.
It can be written a bit shorter like this, logs might help you to find out why it's not working.
Code:
heartbeat_time = 60 -- Minutes
heartbeat_device_object = '32/1/1' -- Change address to your heartbeat device
heartbeat_alarm_object = '32/1/2' -- Change address to a alarm address
obj = grp.find(heartbeat_device_object)
if obj then
delta = os.time() - obj.updatetime
alarm = delta >= heartbeat_time * 60
log(delta, alarm)
grp.checkwrite(heartbeat_alarm_object, alarm)
end