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 TCP/IP slaves and unique Widgets association in visualization or mosaic
#1
Hi,
I would like to make a link between each modbus TCP slave and a unique page or widget of my visualization (one widget per modbus TCP slave). Please is it possible to get slave's IP address  or mac address automatically (by script/.lp file ?) and make the assocation with a unique page or widget ? If yes, how can it be done ? 

I was thinking to the mosaic as i could use a device with embeded webpage and replace its optional remote display interface with my LM's for modbus TCP/IP communication, display user interface menus from webpages and settings features. Any idea for feasibility ?

Many thanks in advance.

B.R,
Chouaibou.
Reply
#2
What kind of widget do you need? Do you want the end user to be able to set mapping or only display current object values?
Reply
#3
Displaying values only is not too hard to implement by .lp. You just need a couple of db queries: one for a list of modbus devices and second one to get mapped object values.

If you want to allow users to modify mapping then you basically need to write it from scratch, at least the UI part.
Reply
#4
DB functions are documented here: http://openrb.com/docs/db.htm

As for DB structure you can extract db file from the backup and use any SQLite tool to examine the database contents.
Reply
#5
You are missing function return value assignment to a variable. And the modbus TCP connect part seems wrong there.

Code:
function checktcp(ip, port)
local settings, res
settings = tostring(ip) .. ':' .. tostring(port)
res = db:getone('SELECT active FROM modbus_devices WHERE proto="tcp" AND settings=?', settings)
return toboolean(res)
end

--Test the DB info of the modbus TCP
res = checktcp('192.168.0.10','502')
log(res)
Reply
#6
If you don't have a profile assigned then querying the database won't do anything because the device is not there. The same thing goes for devices with no object mapping - connection is established only when at least one object is mapped.

Random client port is how TCP client-server works in general - server has a pre-defined port, clients use a random port. As for TCP states you can read about them here: https://benohead.com/tcp-about-fin_wait_...lose_wait/

local port 4304 is used by 1-wire server.
Reply


Forum Jump: