Introduction: Accessing Devices Connected to Router From Remote Place (using Pi and OpenHab)

Suppose if you want to access your IP camera or other devices from remote URL using the openHAB follow the following steps.

Step 1: Step 1:Register in No-IP.com

Go to no-ip.com and create a account there, or else you can use similar services to no-ip. When you sign in you will be able to see the Dynamic DNS as shown in below image. Click on the Hostnames, as shown in the image1.

Click on Add hostname window will appear as shown in image2, enter the IP address and enter the hostname and select the domain and in the Record Type keep it as it is by default.Click Add Hostname.

Step 2: Step 2:Instal1 Ddclient on Raspberry Pi

Now Install the ddclient in the Raspberry pi or linux system by typing the following command .You can also install Noip client on windows which when run will update Ip address

sudo apt-get install ddclient

While installing the ddclient, it may asks for information to be filled, enter the information,afterwards also you can change the information by opening the ddclient.conf in nano editor.

If it doesn't ask any information while installation its ok you can configure after the insatllation.

Once installation is done you’ll need to open up the configuration file with a text editor, Ru this command

sudo nano /etc/ddclient.conf

you will get ddclient.conf file which is shown in the image 1.Enter the details as shown in the file.In the login mention your no-ip username and in the case of password mention your no-ip password in 'password' ,at last mention your hostname ddns, for instance example.ddns.net.

After that’s done, save the file and then restart ddclient run this command sudo service ddclient restart

After few minutes ddclient should initiate a dynamic DNS update with No-IP. If things don’t appear to be working correctly then run ls /var/run command here you should be able to see the ddclient.pid, If it doesn't show the pid then try to uninstall ddclient and reinstall it.

*Note:Password should be entered in single invited comma, in the case of example enter your registered hostname.

Step 3: Step 3:Connect IP Cam/other Devices to OpenHAB to Access From Remote URL

Open demo.sitemap file from the /opt/openhab/configurations/sitemap

In the frame example

Frame label="Multimedia"{

Text label="Multimedia" icon="video" {

Frame label="Multimedia Widgets" {

Video item=IP_camera url "http://youhostname.ddns.net:81/videostream.cgi?user=admin&pwd=admin" encoding"mjpeg" }

}

}

Note: In the above configuration the port no(81) is depending on your IP cam and also username and password may also change .videostream.cgi command may also change.Depending on the IP camera some parameters will change.