LogicMachine Forum
LAN IP to KNX object - SOLVED - Printable Version

+- LogicMachine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: LAN IP to KNX object - SOLVED (/showthread.php?tid=6281)



LAN IP to KNX object - SOLVED - toujour - 29.01.2026

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)


RE: LAN IP to KNX object - SOLVED - FatMax - 29.01.2026

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



RE: LAN IP to KNX object - SOLVED - admin - 29.01.2026

If using DHCP you should bind LM MAC to a certain IP on your router (static DHCP entry). Otherwise LM IP can change randomly.