Modbus diconnection (read failed) - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Modbus diconnection (read failed) (/showthread.php?tid=1883) |
Modbus diconnection (read failed) - Gadjoken - 01.02.2019 Hello, I would like to send an email when there is a modbus disconnection for 30 minutes, the fact that there is random disconnection any time makes that the sending of the mail can occur while the modbus still works . I wish I could have a return of this defect but if it is continual during 30 minutes ... is it possible? B. R. Current Script : require('luamodbus') mb = luamodbus.tcp() -- IP: xxx.xxx.xxx.xxx, port: 502 mb:open('xxx.xxx.xxx.xxx', 502) mb:connect() conectMB = mb:readregisters(5) mb:close() -- CREATION DES SUJET ET MESSAGE POUR MAIL subject = 'subject' message = 'message' subject1 = 'subject1' message1 = 'message1' -- ENVOI DU MAIL SI ALARME VRAI defaut_conectMB = storage.get('defaut_conectMB', false) if conectMB == nil then if not defaut_conectMB then mail('@', subject, message) storage.set('defaut_conectMB', true) end else if defaut_conectMB then mail('@', subject1, message1) storage.set('defaut_conectMB', false) end end RE: Modbus diconnection (read failed) - Daniel - 01.02.2019 Hi If you use profile here is how to check status of modbus device Code: function checkrtu(slave) RE: Modbus diconnection (read failed) - Gadjoken - 01.02.2019 (01.02.2019, 09:48)Daniel. Wrote: Hi Thanks Daniel ! |