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 diconnection (read failed)
#1
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
Reply


Messages In This Thread
Modbus diconnection (read failed) - by Gadjoken - 01.02.2019, 09:38

Forum Jump: