Adding a Z-Wave power plug in Domoticz

It’s time to add our first device to our Z-Wave network consisting of:

  • Raspberry Pi 2 Model B
  • Razberry add-on card
  • Domoticz home automation software running on our Raspberry


If you’re new to Z-Wave it’s recommended to start with a simple sensor such as a power plug. If you start with a 110 dB siren, you might have to go through a bit of configuring in front of your laptop using ear plugs until you get all the settings right. So, start simple and then build from there since that’s the beauty of Z-Wave; once you have a small network up and running, you can add devices stepwise.

Adding our power plug in Domoticz

Make sure your Raspberry is up and running with Domoticz (check this post if you need guidance). Open up the Domoticz user interface in the browser of your laptop.


In the “Setup” menu select “Hardware”.


Click on the “Setup” button on the row of your Razberry unit.


In the “Node management” dropdown list, click on “Include Node”.


For our Z-Wave power plug, it’s now enough if we simply plug it into the wall outlet. It will automatically enter inclusion mode. Other devices might require that you push a physical button on them. This is usually explained in the user manual of your Z-Wave device you’re going to add to your Z-Wave network.


Now, our Z-Wave power plug is added to our Z-Wave network. It’s currently a very small network with one controller (i.e. the Razberry) and one device (i.e. the power plug). In the “Setup” menu, select “Devices”.


Here you can click on the light bulb icon to turn on and off the power plug. Make sure you have a lamp plugged in to the plug to really feel the magic as you wirelessly control the power plug through Z-Wave.


To make the switch appear under the “Switches” tab, we click on the green arrow located on the right side in the row of the power plug.


We name it “Our power plug” and click “Add Device”.


When we click on the “Switches” tab, we see our power plug. If you want the device to appear on the “Dashboard” you simply click on the little star in the power plug box (under the bulb icon).


In future posts, we will go through how to connect a sensor with this power plug so you can trigger the lights to go on when someone enters the room. The same steps can be used to trigger a siren or make a curtain go up when the sun light level decrease below a defined level.

Installing Domoticz on your Raspberry with Razberry

So, like us, you’re into the fantastic world of Z-Wave, which is a great wireless technology for the whole Internet of Things and home automation fields. We will guide you step by step how to install the home automation software “Domoticz” on to your Raspberry equipped with the Z-Wave add-on card called Razberry (easy to mix up Raspberry and Razberry). We like Domoticz because it has a relatively intuitive and nice looking user interface.

What do you need to get Domoticz up and running with your Raspberry and Razberry?


  • A Raspberry Pi (we use version 2). To install Domoticz, we’ll connect remotely to our Raspberry using the command line interface on our Mac. If you need guidance how to remotely connect to your Raspberry, follow these steps.
  • The Razberry add-on card

Plugging in the Razberry add-on card on top of our Raspberry

A good rule of thumb is to always unplug the power from your Raspberry before you plug in or unplug keyboards, mouse, ethernet cables etc. So we unplug the power and then carefully plug in the Razberry card on top of our Raspberry’s GPIO pins 1-10.


The GPIO pins are the pins facing upwards located along the upper side of the Raspberry in the above image. Now, that’s it hardware wise. Make sure the ethernet cable is connected to your home network and then power up the Raspberry again.

Installing the Domoticz software

It’s recommended to make sure the operating system files on your Raspberry is up to date. Here is a guide how you make sure your Raspberry is up to date. Once your Raspberry is powered on, we’re going to install the Domoticz software. We log in to our Raspberry from our laptop. To install the Domoticz software we type the commands below. This creates a folder a installs the software. Note! the character “l” in “armv7l” is not a one, it’s the letter “l”.

   mkdir ~/domoticz
   cd ~/domoticz
   tar xvfz domoticz_linux_armv7l.tgz
   rm domoticz_linux_armv7l.tgz

Make Domoticz start up when Raspberry starts up

Type these commands to make the Domoticz service start up when your Raspberry starts up:

   sudo cp /etc/init.d
   sudo chmod +x /etc/init.d/
   sudo update-rc.d defaults

Reboot your Raspberry by typing:

   sudo reboot

Now connect with a browser on your laptop to see if Domoticz is up and running. In the address field of your browser on your laptop, enter the IP address of your Raspberry followed by “:8080” . In our case it’s “”. It should look like this:


Making Domoticz aware of our Razberry add-on card

Domoticz is made for Z-Wave hardware connected on the USB ports of the Raspberry. Since our Razberry add-on card is connected to the GPIO pins and not a USB port, we need to make a small configuration within Domoticz so Domoticz can speak to the Razberry add-on card. Type the following command in the command line interface:

   sudo nano /etc/udev/rules.d/09-tty.rules

This will open up a basic text editor where you should enter the following text. Press ctrl + O to save the file, and press ctrl + X to exit the text editor.

You have now created a link to a port that Domoticz can use to speak to your Razberry add-on card. Then restart your Raspberry:

   sudo reboot

Configuring Domoticz from the web interface

Once the Raspberry has restarted, we access the Domoticz web interface again by entering the IP address of our Raspberry + portnumber 8080 in the address field of our web browser on our laptop. In our case it’s


Go to the Setup menu and select Hardware.


Make sure “Enabled” is ticked, and select a name of your choice in the “Name” field. We choose “Razberry”. From the drop-down list “Type”, select “OpenZWave USB”, and from the drop-down list “Serial Port” select “/dev/ttyUSB20”. You probably recognize this as the link we created using the text editor. Finally click “Add”.


Your Razberry can now speak to Domoticz. Well done! In future posts we will go through how to add your first Z-Wave devices using Domoticz.



Updating the software of your Raspberry

It’s always good to ensure the operating system of your Raspberry is up to date. You can type the commands listed below directly at the command line interface on your Raspberry, or as we do, through a remote log in command line interface from our laptop. Here is a guide on how to remotely log in to your Raspberry in case you haven’t done it before.

Ensure your Raspberry is up to date

Make sure your Raspberry has started. Then open a terminal window on your laptop and remotely log in using the ssh command, with “pi” as the user and, most likely, “raspberry” as the password (if you haven’t changed the default login credentials).

It’s recommended to make sure the operating system files of your Raspberry are up to date by typing these commands. Each line needs to be followed by pressing the enter key.

   sudo apt-get update
   sudo apt-get upgrade
   sudo reboot

The commands make a lot of text output appear in the terminal window and it might take a while.


As well, it’s recommended to have the firmware up to date. When your Raspberry is rebooted, log in again from your laptop to your Raspberry and type these commands to make sure the firmware of your Raspberry is up to date:

   sudo rpi-update
   sudo reboot


Now your Raspberry should be up to date. Feels great, doesn’t it.

Connect to your Raspberry using Microsoft Remote Desktop

In this post, we’ll explain how to remotely connect to your Raspberry from a laptop using Microsoft’s Remote Desktop. The neat thing about this is that we then get a mirrored screen view of the Raspberry’s graphical user interface on our laptop. No need to connect our Raspberry to any TV, keyboard or mouse. You will love it!

What do you need to set up Microsoft Remote Desktop your Raspberry remotely?

  • First you need to have the Raspberry connected with an ethernet cable to the router of your home network. I other words, your laptop needs to be on the same network (wifi or ethernet) as the Raspberry.
  • Secondly, your Raspberry needs to be turned on (i.e. plugged in with a power adapter).
  • You need to be able to remotely control your Raspberry through the command line interface on your laptop (SSH). If you need guidance how to set this up, check out this post.

In order for your Raspberry and your laptop to communicate through a graphical user interface, we need to install a service on the Raspberry called xrdp. Your Raspberry needs to be connected to the internet. First, do a remote log in to your Raspberry using your command line interface on your laptop (we use Terminal on our Mac). Make sure you see the prompt of the Raspberry in Terminal. Next type “sudo apt-get install xrdp” and press enter.


Type “Y” and press enter when you get the question to continue. The xrdp service will now be installed.


The xrdp is now installed. That’s it on the Raspberry side. Now we are going to install Microsoft’s Remote Desktop app on our Mac which we find on the Mac App Store here. Download and install the app. Open Microsoft Remote Desktop.


Click on “New” and enter a connection name (we choose “Raspberry Pi”), the IP number of your Raspberry, the user name “pi” and the password “raspberry” (assuming you haven’t changed the default user login configuration). You can leave the rest of the fields as they are.


Now, close the configuration window (click the red dot in the upper left corner). You should now have a new configured connection as the below screen.


Double click on the new connection and the remote connection is established and you should get a screen image mirroring your Raspberry’s user interface. We know, it’s magic!


To quit the Remote Desktop session, slide the mouse pointer to the top of your screen so the tool bar of the Microsoft Remote Desktop app appears, click the Microsoft Remote Desktop menu and select quit.

With the two ways of remotely control your Raspberry, i.e. the Terminal or Remote Desktop, there is no need to occupy the TV from your girl friend, boy friend, kids, wife or husband anymore. In subsequent posts, we will almost always use any of these two ways to work with our Raspberry.

Remote command line access to Raspberry Pi

We assume you have your Raspberry Pi up and running and most likely connected to a TV or screen through an HDMI cable. In this post we’ll briefly explain how to access and control your Raspberry remotely without having to have your Raspberry connected to a TV or screen, without keyboard and mouse. If you need guidance how to set up your Raspberry for the first time, follow this simple instruction.

What do you need to access your Raspberry remotely?

  • First you need to have the Raspberry connected with an ethernet cable to the router of your home network. I other words, your laptop needs to be on the same network (wifi or ethernet) as the Raspberry.
  • Secondly, your Raspberry needs to be turn off i.e. plugged in with a power adapter.
  • You need to know the IP number of your Raspberry. In our case it’s Yours could be different since it’s up to your internet router to hand out different IP addresses to all devices in your home network. The IP number is the identification number for sending data to and from devices on a network. One way to find out the IP number of your Raspberry is to log in to your network router and look at the list of the devices currently on your network. If you’re not able to find out the IP number of your Raspberry that way, we’ll go through another way below by using the command line terminal from your laptop.

Connect by using the command line terminal

In this post, we will remotely connect to the Raspberry from our laptop using the command line terminal (also known as SSH). This method is based on text commands. Simple, boring but effective. On your Mac, open “Terminal”. You find this by accessing the Launchpad, go to the Utilities folder and there it is. (If you’re using Windows, you can download a free SSH client from here)


If you’re not used to a command line interface (such as Terminal), it allows you to type in text based commands to control, configure and communicate. The text already appearing in the Terminal window is the name of the computer, the current folder you’re in, and the current user name. You type your commands after the $ sign. If you for example type “ls” without the quotes and hit enter, you see a list of all files in the current folder “example_folder”.


Now, to remotely connect to our Raspberry, we type “SSH pi@” without quotes and hit enter. Your Raspberry has probably another IP address so replace to match yours. If you haven’t yet, you can find out the IP number of your Raspberry by typing “ping raspberrypi”. This outputs some information in the Terminal and one item is the IP number of your Raspberry. To stop the ping output, simply press ctrl + C.


Our Raspberry asks us for the password of the user “pi” which is the default user. The default password is “raspberry”, so we type it in and hit enter. The terminal window will not add any characters or dots while we type the password like your might be used to from most login windows.


Now you see the prompt “pi@raspberrypi:~$”. Every command you type from here is executed on your Raspberry. Magic! If we now type “ls” you list the files in the current directory on the Raspberry.


If you would like to exit the SSH connection with your Raspberry, simply type “exit” and press enter, and you’re then back to your laptop’s prompt again. Executing a command now will be handled by your laptop and not your Raspberry.

Using the command line to remotely control your Raspberry is very effective and simple. There is a getting-used-to-text-command-time before you feel comfortable. If you after a while still prefers a graphical user interface, you should check out this post on how you remotely control your Raspberry from your laptop by mirroring the graphical user interface. It’s very simple as well!


Setting up your Raspberry Pi for the first time

Since you read this, you’re have probably bought a Raspberry Pi and are eager to get it up and running. We have tried to make a very simple step-by-step guide below to help you succeed.

What do you need?


On our table we have the following items to bring our empty Raspberry to life:

  1. One Raspberry Pi 2 Model B
  2. One micro USB power adapter for powering the Raspberry. Most standard 5 volt smartphone chargers would do. Ideally it should have capacity for 1.8 A or more.
  3. One MicroSD card (8GB recommended) and USB adapter for copying files to the card from you laptop.
  4. One USB keyboard
  5. One USB mouse
  6. One HDMI cable to plug your Raspberry into your TV or computer screen
  7. One laptop (in our case a Macbook Pro)

Start by downloading the operating system to your MicroSD card

Make sure your MicroSD card in empty and formatted as FAT32. Download the zip-file containing the operating system Noobs from this link (from and save it to your laptop’s hard drive.


Unzip all the files and copy them to your MicroSD card.


Plugging in your MicroSD into your Raspberry to start up

Before plugging in your Raspberry to your power adapter, insert your MicroSD card, plug in your keyboard, mouse, and connect the HDMI cable between your Raspberry and your TV or screen.


Install the operating system

Now, plug in the power adapter and you should see the boot-up screen.


Click the check box for Raspian and click install. Then click Yes. The process of installing the operating system takes a while. Be patient, it’s worth it!

Setting up the basics

From here we set the time and location. Click on the menu in the upper left corner and select Preferences->Raspberry Pi Configuration.


If you select the tab Localisation, you can set your locale and timezone.


If you plug in an ethernet cable between your internet router and your Raspberry, you automatically get the correct time each time the Raspberry boots up. Having your Raspberry connected to the internet also enables you to get software updates and browse the internet from your Raspberry.

Where to go from here?

From here the possibilities are almost endless of what you can do with your Raspberry. We know, it feels a bit overwhelming. You can use it to create computer games, connect a camera module or have it be the brain in your home built drone. To get inspiration and guidelines, check out the project tutorials at or follow our future posts as we build a system for monitoring and controlling your home in the spirit of Internet of Things.