HowTo: FHEM – Installation on the RaspberryPi

A term that is more often stumbled upon in everyday life is "SmartHome". But what is behind it? And do I really need that?

Smart home (= intelligent home) is a generic term for the networking of various devices in the household.
The ideal is that more and more devices in the household communicate with each other, exchange data and control our home based on this data automatically.
So these systems should take over work from us.

As always, this is best explained by an example:
If you have a smart home system at home, this could automatically turn off the heater (or turn it down) if you are not at home, if you return, the heater will automatically turn back on. Of course this does not happen until you come through the front door but already when you are on the way back.
Likewise, other unused devices (eg, the light) could go into a low power mode or be turned off when it is detected that nobody is at home.

Now, the average human will probably say: "I don't need something like that. People have survived the last two thousand years without it. "
All I can say is: yes, that's right!
But it is like many things in life: you do not really need it, but it makes life easier.
The same argument goes somewhere for the cell phone, car, TV, supermarkets and everything else in our lives that we do not really need but do not want to miss anymore.

What is currently much more against this system or systems speaks that it is very quickly very expensive and there is no universal standard.
For example, controllable plugs – plugs with which you can use to turn on and off a lamp, for example – now cost from 40 € upwards. If you want to switch several devices with it, you will quickly lose a lot of money.
In addition, switchable outlets from AVM are not compatible with switchable Osram lamps. Each company cooks its own soup on the topic of smart home. If you have several systems in use, this inevitably means that some sensors and actuators (such as switchable sockets) can not communicate with each other and that you have to handle these things always means you have to deal with multiple apps.
Another argument that causes me abdominal pain in commercial systems: Where do my data go? Who knows that I am not at home right now and can probably do it? even take advantage?
All the arguments that actually speak against the fact that a smart home should make everything easier and safer.

FHEM beats into this notch. This is an open-source smart home management software that is publicly available for free.
That means this software and also its code are public. Everyone can see that this software does not send data to any foreign servers.
The great advantage of this is not only that such a system is significantly cheaper, you can also summarize with FHEM several systems from different manufacturers and control centrally.
Meanwhile, FHEM has become so versatile that in my opinion it is difficult to find hardware that is not compatible with it.

What is needed to use with FHEM your first smart home in operation and what to pay attention to, is explained in this article. I will link to more examples of the different uses after the article.

Required hardware

Of course, in order to keep FHEM watching over your home, it must run continuously. But of course this should happen as cheaply as possible.
That's why this is a perfect location for the RaspbberyPi. This is a credit card sized computer that, once set up, can be placed somewhere in the closet.

Safety instructions

I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance.

Affiliate links / advertising links

The links to online stores listed here are so-called affiliate links. If you click on such an affiliate link and store via this link, receives a commission from the online store or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support in being able to offer further useful projects in the future. 🙂


Before you start with this article, you should have prepared the RaspberryPi so far that it can be reached via the network and controlled by SSH.

The following three articles describe what to do to prepare the RaspberryPi so far:
RaspberryPi - Setting up for Nerdiys!
RaspberryPi - The first configuration
RaspberryPi - Controlling the RaspberryPi via SSH

Required tools:

Materials required:

In the following list you will find all the parts you need to implement this article.

Log in via SSH on the RaspberryPi

To get started, you first need to log in to RasPi with SSH on Putty. How to do it is described in the article

After entering your username and password you can start to enter the first commands.

Update package management

The package management in Linux is a "central point" over which various software packages can be installed. For this to work reliably, the lists and sources of package management should be updated before installing any new packages.

To start the package management update you have to enter the following command.
sudo apt-get update && sudo apt-get upgrade
Depending on how long your last update of the package management is, this process may take some time. First, the lists are updated in which the individual repositories are referenced.
Then the packages themselves are updated. As this additional memory is occupied, you will be asked again for your consent. You have to confirm this with a "J"(in German) or a "Y" and "Enter".
When the update is complete, you will see a small summary of the duration and scope of the update.

Install required packages

So that FHEM runs properly you have to install various auxiliary packages. The installation can be done with the following commands.

sudo apt-get install libdevice-serialport-perl && sudo apt-get install libio-socket-ssl-perl && sudo apt-get install libwww-perl && sudo apt-get install libcgi-pm-perl && sudo apt-get install libjson -perl && sudo apt-get install sqlite3 && sudo apt-get install libtext-diff-perl && sudo apt-get install libdbi-perl && sudo apt-get install libdbd-sqlite3-perl

During the installation of the auxiliary modules it may be necessary to ask if you agree that additional space is occupied by the modules to be installed. You confirm these demands with a "j"(German) or "y" and enter. The installation will then continue.




















Download FHEM

After the installation of the auxiliary packages, the actual software of FHEM can now be installed. You will need to download the package from the FHEM website. This goes with the displayed command and the corresponding link.


It should be noted that FHEM is constantly evolving. The part "XY" in the link therefore stands for the possibly changing version of FHEM. For the current version (5.8) the link would be for example


The current version is always visible on the website of FHEM at in the upper area. So you have to adjust the links accordingly and then run the download on the Rasp Pi.

Install FHEM

After the download finished, the downloaded package needs to be installed. This is done with the following command. You also have to adapt this again to the corresponding version.

sudo dpkg -i fhem-XYdeb

For the current version(5.8):

sudo dpkg -i fhem-5.8.deb

Installation completed

FHEM is now installed and accessible at the IP address of your Rasp Pi.
Now type the IP address (the same as you use to connect to Putty) in the address bar.
Behind the IP address you write the port on which FHEM is reachable with a colon in front of it.
For example ":8083".
If your Raspi has the IP address then the link to FHEM would be

What you see now is the first homepage of FHEM. Of course FHEM cannot do much in this first state. How you use the FHEM configuration page, protect it with a password and also activate a slightly more upbeat design you will find out in the following articles:
FHEM – Structure, Modules & Worth Knowing
FHEM – Secure access to the configuration interface

Have fun with the project

I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂

P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate that I share this information with you, I would be happy about a small donation to the coffee box. 🙂

Buy Me a Coffee at   

Kommentar hinterlassen

Your email address will not be published. Erforderliche Felder sind mit * markiert