Integration of NetPing Devices into The openHAB Smart Home System

  • Published In: Tutorial
  • Created Date: 2021-01-30
  • Hits: 2430

NetPing setting up in OpenHAB is quite ordinary process since the device supports different management methods, including SNMP protocol. These devices are generally designed to function in server rooms for monitoring and remote power management, but they can be easily integrated into smart home for a variety of tasks.

OpenHAB — is one of the most popular and versatile platforms for home automation solutions. This open-source project intends to set the Internet of Things to an absolutely new level according to its quality, combining different devices from different vendors into a single ecosystem and allowing them to be managed from one point.  NetPing setting up and configuration in OpenHAB is quite ordinary, since the device supports various management methods, including SNMP protocol. These devices are generally designed to work in server rooms for monitoring and remote power management, but they can be easily integrated into smart home for a variety of tasks.

The value and practicability of a smart home is not so much in displaying the current state of devices, but in the fact that you can program the reaction of each device to changes in the system. In order to do this, of course, you should have not only devices that allow you to read the state of the system from sensors, but also special devices with actuating mechanisms, for example, controlling the electricity supply.

In this article, we will show you how to deploy an OpenHAB smart home system on the popular single board computer Raspberry Pi, as well as how to control peripherals.

OpenHAB Installation on Raspberry Pi

The main problem arising while implementing smart home systems  is vendor lock-in. Every manufacturer of related equipment, be it smart bulbs, sockets or curtain drives, tries to ensure that it functions correctly only within its own ecosystem. This can be a mobile application, a cloud service, or a hardware controller.

For an ordinary user it can be very problematic as most often there are already some devices in the house with "smart" capabilities that the owner will not get rid of. The main task here is to create a certain abstraction layer that will communicate with end devices in their own method and language, and provide the user with these devices in the form of cross-funtional elements. It resembles the Lego constructor, where you can assemble any complex structure from different parts with a single fastening method.

In order to show you how it works, we need to Download OpenHAB and deploy it. Since this system is cross-platform and created in Java, it can be run on any computer, server, coffee maker or NAS drive. However, the easiest way to do it is to deploy OpenHAB on a Raspberry Pi. The fact is that for this single-board computer, an operating system image was created with pre-installed OpenHAB and dependent services called OpenHABian.

openHABian Image Writing

We take the image of the SD card from the GitHub repository in XZ format and the balenaEtcher utility, which works on all popular operating systems: Windows, Linux and MacOS. You do not need to unpack the archive with the image - Etcher can write the image directly.

We write the image to an SD card, insert it into the Raspberry Pi, turn on the power and wait for 15-45 minutes. Make sure you have connectivity by plugging an Ethernet cable. The process of installation starts immediately after the launch and OpenHAB updating begins. If everything goes well, then in 45 minutes at most you will have a fully working platform for home automation.

If you need it is possible to connect an external monitor or go to the browser http://openhab/. The installation progress will be displayed there. If the system seems to be frozen, you should not reboot it, you need to wait for a few minutes. The thing is that the installation speed most often depends on the speed of the SD card, so this process can be performed for a rather long time on SD cards with slow speed without responding to user actions. If a crash occurs, you can proceed to documentation,  where you can find the detailed steps to fix the problem.

What to do after the first launch

After the installation is complete, OpenHAB will be available both through the web interface and via SSH. The Login and password is openhabian / openhabian. Before you you start creating your smart home system, you have to use the configurator to configure the basic parameters. To do this, go to SSH and use the command:

sudo openhabian-config

Change the default passwords to your own ones, if necessary, configure the network settings and set the time. Now you can safely go to the web interface at:


Image 1 — OpenHAB web interface main window

Here you can find the short description of main functions:

  • OpenHAB Log Viewer —allows you to view the log file in real time and see how data exchange is carried out between devices and the system. If something went wrong, the log file will tell you where the problem occurred.
  • OpenHABian Help — the link to open documentation. OpenHAB has quality, well-written documentation and a strong community.
  • BasicUI —the web interface to control your smart home built on the basis of Google design. This section will be empty till the moment when the corresponding Sitemap files are generated. You can find the detailed information about it below.
  • Home Builder — a file generator. it allows you to create a basic textual home description template with a specific syntax. We will write about it later.
  • Paper UI — a powerful web interface through which it is possible to configure almost everything in OpenHAB: bind devices, set parameters, install add-ons. This interface will be our main tool.
  • HABpanel —  Here you can find the interface for the user of smart home that we will create. Later, we can both view information about devices and interact with them by opening this panel.

Now we will describe a little the terminology and structure of elements in OpenHAB. We have already mentioned that this system is capable of combining devices from different vendors. In order to do this add-ons called Bindings are used. By installing a specific add-on of this type, we get support for the desired type of device. The required Bindings are installed with just one click in the Add-ons - Bindings section.

Image 2 — Add-ons Selection in OpenHAB

If you need to find out which Binding is suitable for a particular device, you should go to  project`s website, which not only lists all the available options, but also describes in detail how to use them. In any case, it is worth starting from those control and monitoring protocols which each specific device supports. Since all NetPing equipment supports SNMP protocol, we can use it both for data viewing and for management. 

Configuring SNMP management

For OpenHAB to receive SNMP support, we will find the corresponding add-on in the Bindings section and install it using the Install button. OpenHAB needs to receive SNMP support. In order to do it, we should find the corresponding add-on in the Bindings section and install it using the Install button.

Image 3 — Finding SNMP Binding add-on and Installation

After the add-on has been installed, we can proceed to adding the device to the configuration. Go to the Things section, click on the + button and select SNMP Binding - SNMP Target:

Image 4 — Adding a Device for SNMP Management

Set a clear name for the device in the Name section, Thing ID is generated automatically to ensure the uniqueness of the name, but you can also change it. The key parameters are the IP-address or hostname of the device, the SNMP protocol version and the SNMP Community. Most often, manufacturers use "public" as their community, but this is not very secure.

NetPing 2 IP PDU GSM3G 203R15 has a community value - SWITCH by default. You can view and change it through the device's web interface.

Image 5 — Community Configuration in Netping

Power Port Management

Once you added the device, you need to define the communication channels. Go to the Configuration - Things - Device name section. On the device page in the Channels subsection, click on the + button.

Image 6 — Add Channel Dialog Section

Select the channel type from the three offered options: Number, String or Switch. Since we will manage the sockets on the NetPing 2 IP PDU GSM3G 203R15 device, it will be enough to select Switch. Now the configuration window is transformed and more different options become available, the most important is OID.

We will not write detailed explanations of the SNMP protocol, we only note that this numeric value separated by dots can be found by downloading the MIB table of your NetPing device and opening it using any utility for working with such files, for example iReasoning MIB Browser.

The other actions are quite easy. Set for the switch:

  • Mode — Read/Write,
  • Datatype — Integer 32 bit,
  • On-Value — 1,
  • Off-Value — 0.

After setting the control channel, turn it on by placing a dot in the blue circle opposite the channel, and connect all this to the interface by adding Item with the Switch type. The following screenshot clearly shows how the hierarchical structure is formed:

Device (NetPing)

    └ Control channel  Power 1(SNMP_Target:Thing_ID:SNMP_OID)

        └ Interface for the panel Linked items (PowerPort1)

Image 7 — Hierarchical Structure

The system is now completely ready to control the socket of the device with OID, but in order to do it the socket must have an interface. In OpenHAB, the user creates the interface for each element of the smart home on their own, and it is possible to do via the HABpanel.

Successively create the panel by clicking on the symbol with a grear and add a switch widget there. All the devices which were added correctly will be displayed in openHAB Items.

Image 8 — A widget of a Power Switch on the socket of a NetPing devcie

As soon as the configuration is saved and launched, both widgets will allow you to control the ports of the physical device just by clicking. When we press the button, the system generates and sends an SNMP command, and NetPing processes it accordingly, turning on or off its 220 V power sockets. 

Image 9 — An Example of an Interface created in HABpanel

Receiving data from sensors

As NetPing supports the ability to connect a large number of different sensors, it is possible to read indicators using SNMP. For example, we will take a temperature and humidity sensor. Before doing it, we looked at the corresponding OIDs in the MIB browser.

Image 10 — Viewing the MIB-tables of a NetPing device

Get-inquiry messages on the OIDs which were found give numerical values of temperature in degrees Celsius and humidity in percent. Now we need these readings to be read and displayed in OpenHAB. Add the required channels to the device which you have already created and to the interface in exactly the same way.

Image11 - Hierarchical Structure

In order to undate the data constantly, it is possible to set forced auto-update via Configuration — Items — <Item> — Auto Update — Enforce an auto update.

Image 12 — An example of an interface on a smartphone with Android

Connection with openHAB Cloud

Controlling your smart home locally on OpenHAB is not a problematic process, but the remote access task can be quite challenging. It is required at least to get a "white" IP-address and configure port forwarding on the router correctly. In some cases, this task cannot be solved.  where the A free cloud comes can really help here, allowing you to control your smart home from any location. To take advantage of this cloud you need to register there. The sustem will ask for a unique openHAB UUID and an openHAB Secret password. So let's get this data first.

Open the Paper UI and install the corresponding add-on for synchronization with the cloud Add-ons - Misc - openHAB Cloud Connector - Install. Enter the server using SSH and execute two commands:

cat /var/lib/openhab2/uuid

The answer is our openHAB UUID. Write it and now get openHAB Secret:

cat /var/lib/openhab2/openhabcloud/secret

Save the received line too and proceed to the registration on the website:

Image 13 — Modal registration window on

The cloud will do the rest of the work. After clicking the Register button, you will see the window which say that adding your local home to the cloud was successful. To go to the control panel, you just need to click the link:

Image 14 — Local smart home based on OpenHAB successfully connects to MyOpenHAB cloud

So, now you can control you smart home from anywhere in the world just opening the link

How does it function? It is very simple. OpenHAB with openHAB Cloud Connector installed constantly requests the cloud address for a valid account, and if one is found, it sends a valid IP address and port address for connection. Since the connection is outgoing, you do not need to forward ports on the router, as well as buy a "white" IP.


It got impossible to connect Alice system and OpenHAB for a voice control after August 2019. The Reason: MyOpenHAB cloud stopped supporting IFTTT due to heavy load on servers. 

If you try to connect it to Google Assistant, it fails at the stage of adding a cloud service, despite correct authorization.

The only integration option is to write your own backend, which is beyond the scope of this material and is not applicable for ordinary users.

The instruction  is not up-to-date any more and can not be used for integration.

comments powered by Disqus