Logic Machine Forum
Modbus communication error - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: Modbus communication error (/showthread.php?tid=469)



Modbus communication error - Mirco - 23.11.2016

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


RE: Modbus communication error - admin - 23.11.2016

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.


RE: Modbus communication error - Mirco - 24.11.2016

Thanks!
How can I check the last update time of an object with script or javascript?


RE: Modbus communication error - admin - 24.11.2016

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)



RE: Modbus communication error - Mirco - 24.11.2016

Thank you! Big Grin


RE: Modbus communication error - automatikas - 24.01.2017

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



RE: Modbus communication error - Mirco - 18.05.2017

(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?


RE: Modbus communication error - admin - 18.05.2017

Maybe for the next major version, not sure at the moment