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.

IP address
#1
Good afternoon,

I have a question regarding creating objects in Logic Machine. I'm finishing a BMS project, and this project includes three Logic Machine 5 instances. The IP addresses used for these instances are 192.168.0.12, 192.168.0.13, and 192.168.0.14.

The BMS specifications require the following:

• IP Address: Manually entered local variable.

• Alarm IP Address: Automatically entered BACNET variable. Indicates that an address is not responding to PING.

• Communications Test Frequency: Manually entered local variable. Indicates how often communications monitoring should be triggered. Selectable range: 1-23 hours.

• IP Test Enabled: Enables IP address monitoring.

• Enable KNX Test: Enables monitoring of all KNX buses.

I have no idea how to do this. I don't know if there's a way to create objects that point to IP addresses, or if it requires Lua programming.

I can include an image of what I expect to see on the screen with these variables. Thank you very much.
Reply
#2
LM can ping a IP or KNX physical device but some of the other points makes no sense or not clear.

https://forum.logicmachine.net/showthrea...6#pid16696
https://forum.logicmachine.net/showthrea...7#pid22677
------------------------------
Ctrl+F5
Reply
#3
THANK YOU VERY MUCH,

I've been able to verify that if we create a script with the function from the first link on an object:

function ping(ip)
local res = os.execute('ping -c 2 -W 5 ' .. ip)
return res == 0
end
res = ping('192.168.0.11')
grp.checkwrite('32/6/113', res)

And the IP address is incorrect or there's no communication, the script returns 0.

I have a question: I have a series of IP addresses that need to appear on the screen like this, but I can't get it to work.

Attached Files Thumbnail(s)
   
Reply
#4
Use 250 byte string object.
------------------------------
Ctrl+F5
Reply
#5
You should use new Visu Smile

What task exactly do you have? Do you need IP list to be configurable or do you simply want to display the status for each IP?

If the list is fixed you can make a resident script that pings each address and updates the status. You can add as many IP/group address pairs to the ips table.
Code:
ips = {
  ['192.168.0.1'] = '0/0/1',
  ['192.168.0.2'] = '0/0/2',
}

function ping(ip)
  local res = os.execute('ping -c 2 -W 5 ' .. ip)
  return res == 0
end

for ip, addr in pairs(ips) do
  res = ping(ip)
  grp.checkwrite(addr, res)
  os.sleep(1)
end
Reply
#6
As far as I know,

I've programmed two logic machines to control a building and its garage, with IP addresses 192.168.0.11 and 192.168.0.12. The building's logic machine also has three gateways to obtain data from residential electricity meters with IP addresses 192.168.0.111, 192.168.0.112, and 192.168.0.113.

What I'm being asked to do is create variables for each IP address. I understand these to be Boolean values ​​indicating whether or not a ping is detected.


A variable that enables or disables pinging to IP addresses (boolean type), the address I use for this is '32/6/118', and another variable that sets how often the monitoring is done in hours '32/6/117', this has values ​​from 1 to 23 hours
Reply
#7
This is way too complicated, just create a Scheduler script with fixed frequency and display results on the screen. You can alos use another script to enable/diable this scriopt if you want.
------------------------------
Ctrl+F5
Reply
#8
If meters are using Modbus then you don't need to use ping at all because you can use status object in Modbus mapper.
Reply
#9
Yes, the counters use Modbus RTU; I imagine you mean using their mapping.

But what I'm monitoring are the gateways I have connected to the logic machine, not the counters connected to them.
Reply
#10
This
   
------------------------------
Ctrl+F5
Reply
#11
So, if I've created a virtual object, called, counter_state 32/2/66, for example, and I associate this with the status object in the Modbus section, if communication with the counter is lost, the value of address 32/2/66 will change state, is that right?
Reply
#12
yes
------------------------------
Ctrl+F5
Reply
#13
So what you're telling me is that the operating logic should be the following:

-NO COMM.------------------------------------>32/2/66 == 0
-COMM.------------------------------------------>32/2/66 == 1

(05.03.2026, 14:42)ALEJANDRO Wrote: So what you're telling me is that the operating logic should be the following:

-NO COMM.------------------------------------>32/2/66 == 0
-COMM.------------------------------------------>32/2/66 == 1

Sorry for being so insistent, but I want to be sure that the object's value is changed automatically.
Reply
#14
yes it does, this is the whole point of it. 1 online, 0 offline,
------------------------------
Ctrl+F5
Reply
#15
Something's wrong, I can't get it to work, that's strange.
Reply
#16
Is your device working and LM can read values from the meter?
------------------------------
Ctrl+F5
Reply
#17
Yes, it is
Reply
#18
How do you test?
------------------------------
Ctrl+F5
Reply
#19
I didn't understand your question
Reply
#20
You say that something doesn't work. To claim such state you must have done some test to check if it works or not. What did you do to validate the functionality?
------------------------------
Ctrl+F5
Reply


Forum Jump: