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
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.
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:
<!DOCTYPE html>
  <meta charset="UTF-8">
  <link rel="stylesheet" href="/apps/css/bootstrap.css">
<table class="table table-striped">

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

for _, item in ipairs(items) do
  datetime ='%Y.%m.%d %H:%M:%S', item.errortime)
<? end ?>
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.

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

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.

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

I tried the same and works fine for me. Paste URL you use.
This looks correct and what do you see when you open it? For frame inside same LM you can just use /user/modbus.lp
Could it be a permission issue?

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

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

Attached Files
.lp   modbus.lp (Size: 558 bytes / Downloads: 3)
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.

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.

Attached Files
.lp   modbus.lp (Size: 578 bytes / Downloads: 1)
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.
Well, it's exactly the same as I did, mysteries.
Ok with the settings.
Thank you very much for her help.

Forum Jump: