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.

LAN IP to KNX object - SOLVED
#1
Hi,

How can I read the IP LAN assigned by DHCP server to one KNX object ? So I can know the IP address of the LM in DHCP mode (similar at pubblic address IP for WAN ).
Otherwise, is there a way to know the IP address of the LM in DCHP mode without internet connection ?

Thanks,
Alberto

require('json')
require('socket.http')

ip = io.readproc('if-json')
ip = json.decode(ip)
log("IP address: " ..ip.eth0.inetaddr)
KNX Advanced Partner + Tutor
Reply
#2
For public IP:

Code:
require('json')
require('socket.http')
socket.http.TIMEOUT = 5
local data = socket.http.request('http://api.ipify.org')

if not data then
  return
  log('No response getting IP')
end

--log(data)

if data == 'Bad Gateway' then
 
else

ip_old = storage.get('ip_old')
if ip_old == nil then
  storage.set('ip_old', data)
end
Reply
#3
If using DHCP you should bind LM MAC to a certain IP on your router (static DHCP entry). Otherwise LM IP can change randomly.
Reply


Forum Jump: