This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Modbus communication error
#1
Exclamation 
Hi,
is there a way to set an address group to 1 if there is an error with the modbus communication?
I use the RTU Modbus communication with profiles.

Thanks
Reply
#2
We have plans to add a status object, but it will work the other way round: 0 = missing, 1 = present/ok. As a work-around you can try monitoring one of the mapped objects last update time to check for failed communication. But this might not work if register value is not changing very often.
Reply
#3
Thanks!
How can I check the last update time of an object with script or javascript?
Reply
#4
This is how you can delta time in seconds between now and last object update:
Code:
obj = grp.find('1/1/1')
delta = os.time() - obj.updatetime
log(delta)
Reply
#5
Thank you! Big Grin
Reply
#6
Thumbs Up 
missed the post. It does work fine.

i used for loop as i have 36 devices


Code:
offline_time = 600 --offline detection time in seconds

-- for i = START, STOP, STEP
for i = 1, 36, 1 do
 address = ('13/1/'..i)
 obj = grp.find(address)
 delta = os.time() - obj.updatetime
 address = ('13/0/'..i)
 if (delta > offline_time) then
   grp.update(address, false)
 else
   grp.update(address, true)
 end
end
Reply
#7
(23.11.2016, 08:01)admin Wrote: We have plans to add a status object, but it will work the other way round: 0 = missing, 1 = present/ok. As a work-around you can try monitoring one of the mapped objects last update time to check for failed communication. But this might not work if register value is not changing very often.

Any news about the status object for modbus communication?
Reply
#8
Maybe for the next major version, not sure at the moment
Reply


Forum Jump: