How to get IP address of openhab running in rasbery pi

Is there any api or any solution from which i can get ip address of openhab running in rasbery pi .

Systeminfo binding can provide you this information using the network#ip channel.

I have installed it and the network i/p channel is showing me like state undefined,
How i solve this, please help me

Did you link it to any item?

no i have not linked to any item

Then you can not get any data.
So, please before posting, read this.

openHAB is running a Zeroconf implementation and can be discovered with mDNS.

You can install avahi and the avahi-utils on Linux/Mac and find the openHAB server like this:

root@linuxserver ~# avahi-browse _openhab-server._tcp -r       
+   eth0 IPv4 openhab                                       _openhab-server._tcp local
=   eth0 IPv4 openhab                                       _openhab-server._tcp local
   hostname = [JmDNS-IP-1.local]
   address = []
   port = [8080]
   txt = ["uri=/rest"]

If you want to program it, almost every programming language has a zeroconf library ready to be used.

This is also how the Android App (and probably the iOS app) discovers the running openHAB instance on your network.

I think he is already accessing openHAB, I understood that he wanted to access the IP address from within openHAB!

I think he is already accessing openHAB, I understood that he wanted to access the IP address from within openHAB!

yes, i want the same thing

Please, Any one helps me to sort this issue

You should take the advice already given by @george.erhan. Just link an Item to the network#ip channel.

Maybe you should read the beginner´s tutorial for basic understanding.

I also get an error in openhab.log trying to get the IP adress from the systeminfo binding (openhab 2.1 stable):

2017-10-29 10:16:41.466 [ERROR] [systeminfo.handler.SysteminfoHandler] - No information for channel network#ip with device intex 0 :
org.openhab.binding.systeminfo.model.DeviceNotFoundException: Device with index: 0 can not be found!

So my guess this is not a beginners error but something wrong in the binding.

Also note the type in the error log: intex 0 (which should be index 0)

I just set up the example from the manual and it works.

systeminfo:computer:work [interval_high=3, interval_medium=60]

/* Network information*/
String Network_IP { channel="systeminfo:computer:work:network#ip" }

sitemap systeminfo label="Systeminfo"
  Frame {
    Text item=Network_IP label="Device IP [%s]"

I can see the IP of the device displayed on the sitemap. I use a rpi3. Maybe reinstalling the binding helps.

Not entirely sure what you’re asking here. Do you mean how can you identify what IP address belongs to your OpenHAB installation?

The easiest and best practice means of doing this would be to assign a static IP to the Pi hosting the service. You can do this on a DHCP basis, or simply assign a static IP to the relevant interface on the Pi.

If, on the other hand, you are asking how, in any given network, you can identify which devices are hosting OpenHAB, then you will need to take a device fingerprinting approach.

Given that we know OpenHAB opens up port 8080, the easiest way would be to send a HEAD HTTP request to each device on the network, and use this to determine if the port is open and whether it has the x-powered-by header.

Do you mean how can you identify what IP address belongs to your OpenHAB installation? (yes).

Okay, so you’ll want to set a static IP.

If you have a wifi router or something providing your internet access, you’re probably already using DHCP. You’ll want to log in to your router, and input the MAC address of the Raspberry Pi interface. Then the Pi will always stay at the IP you assign. If you want to get more complex (and better) you can use a local DNS service to link your Pi to a domain name, e.g., openhab.myhome

To get the MAC of your Pi interface, just type in sudo ifconfig

If your Pi is plugged in with an internet cable, you’ll want to look for the MAC of interface eth0. If it’s connected by wifi, I think it’s called wlan0.

Same issue as Akshay has/had with Systeminfo here.
RPi3 is connected with cable and running openHAB 2.3.0~20180418031157-1 (Build #1259)
netstat -i shows this:

Kernel Interface table
eth0       1500 0    127262      0   3057 0        103849      0      0      0 BMRU
lo        65536 0      1644      0      0 0          1644      0      0      0 LRU
wlan0      1500 0         0      0      0 0             0      0      0      0 BMU

network#ip doesn’t show me anything.
network#mac shows me a MAC address which is not the one associated with eth0
network#networkName shows me wlan0 ???
How is this possible?
Tried network1#ip and network2#ip without succes.