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 whether you accept or reject these cookies being set.

Modbus error handling
#1
Hello
I am delving into the use of Modbus in wiser and I am with profiling and memory mapping. For now everything is fine and above all easier with Daniel's profile manager.

The question is that now I would be interested to see how I handle the issue of modbus errors.

In the Modbus tab, by clicking on the error logs button, they appear in the pop-up window if there are errors in the communication. So my questions are:
  How can I access those errors?
With a script?
How many errors are there?
Could you assign them to alerts?

Thank you.
Greetings
Reply
#2
Errors are stored in a separate DB table. There's no direct way of placing these error into alerts.
You can show them in the visualization via .lp file placed into an iframe. This will show a table with the latest 50 Modbus error logs:
Code:
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <link rel="stylesheet" href="/apps/css/bootstrap.css">
</head>
<body>
<table class="table table-striped">
<tr>
  <th>Date/time</th>
  <th>Error</th>
</tr>
<?
require('apps')

items = db:getall([[
  SELECT * FROM modbus_errors
  ORDER BY errortime DESC
  LIMIT 50
]])

for _, item in ipairs(items) do
  datetime = os.date('%Y.%m.%d %H:%M:%S', item.errortime)
?>
<tr>
  <td><?=datetime?></td>
  <td><?=escape(item.errortext)?></td>
</tr>
<? end ?>
</table>
</body>
</html>
Reply
#3
Hello
Thank you for the answer.
She thought it would be easier, but this solution is feasible.

Any document, thread or tutorial to learn how to use .lp files? I have read it several times in the forum but I do not know exactly how to use them.

Greetings
Reply
#4
Save the file as modbus.lp, enable FTP server in System Config, connect via FTP by using apps username and upload modbus.lp file into user directory. Then you can access it via http://LM_IP/user/modbus.lp
Reply
#5
Hello

Very concise but perfect instructions, thank you.

I have placed the iframe in the visualization and in url I have put the indicated one, changing to the corresponding IP.

A frame is displayed with the date / time and error columns, but no records.

In the modbus tab if errors appear, in fact I have it active and mapped but the modbus device not connected, so the error in the image appears.

I have rebooted and the logs are not showing.
What could be happening?

Now that I think about it, I have not indicated that it is Modbus TCP, in case it is relevant.
Greetings



Reply
#6
Try opening the url in browser.
Reply
#7
It also does not work as I tried it above.

Greetings
Reply
#8
I tried the same and works fine for me. Paste URL you use.
Reply
#9
http://192.168.0.10/user/modbus.lp
Reply
#10
This looks correct and what do you see when you open it? For frame inside same LM you can just use /user/modbus.lp
Reply
#11
Could it be a permission issue?



This is what i see
Reply
#12
So the page is actually loading, I see this:
   
Reply
#13
The frame appears but is completely empty. IN the above post is the capture of what I see on the visualization.
Reply
#14
Same for me, this is end visu. I have no more ideas. Admin?
Reply
#15
As the last test.

Can you send me the file, in case it is something relative to how I create it?
Reply
#16
Here you go

Attached Files
.lp   modbus.lp (Size: 558 bytes / Downloads: 3)
Reply
#17
Eureka ¡¡¡It is the file.

Something incomprehensible, I have created it with Notepad ++ and put the extension, even with Visual Studio Code, thinking that the problem could come from that side. I have also tried with a text file changing the extension and nothing.
Will it be the extension? Although it seems silly, it is Lp (I put it in capital letters to distinguish it) not Ip, because of the source I will stop the same. Although I have tried both.
I am attaching my file in case you see the problem.

Thank you very much for your invaluable help.
Greetings


One more question.
What is the best configuration of the frame?
Persistence yes / no
Update time?

I notice that if the page is not reloaded, the records are not updated.
Greetings

Attached Files
.lp   modbus.lp (Size: 578 bytes / Downloads: 1)
Reply
#18
I created it in notepad++ and just saved it directly from there and just typed the extension while saving .lp
You can set the refresh in some seconds for frame otherwise you will need to refresh manually.
Reply
#19
Well, it's exactly the same as I did, mysteries.
Ok with the settings.
Thank you very much for her help.
Greetings
Reply


Forum Jump: