If you want to start with home automation and search for a suitable server system, you should look at Synology's DiskStation. Compared to the usual hardware suspects such as Raspberry PI, a DiskStation offers some advantages: real hard disks, if necessary with redundancy, higher performance and thus the possibility to run further services and for example also to store backups from other computers.Clearly, an entry version of DiskStation is slightly more expensive than a PI, but the additional benefits and higher reliability will pay off sooner or later. For those who already have a DiskStation, it is anyway a good idea to install the software for home automation on it.
Please note: older Diskstation models do not have a floating point unit (FPU). Oracle does not provide Java packages for processors without FPU. Therefore the following instructions will only work on Diskstations with FPU. You can check wether your Diskstation has an FPU in the list provided by Synology.
A ready-made package - comfort with drawbacks
One way to get openHAB on the DiskStation is to use the ready-made openHAB package. This has a clear advantage: it is extremely simple to install. However, it also has three disadvantages:
- You will later be less flexible with regard to the setup / configuration of openHAB
- You have to worry about how you get the other software for your home automation to run (it is usually not done with openHAB alone) and
- At least on my diskstation the start times and the performance of openHAB were much worse with the prebuilt package compared with the method, which I show you in this article.
Setting up OpenHAB in 2 steps
The DiskStation runs DSM as its operating system, which is a customized Linux. We use this as our advantage and install openHAB as follows:
- In addition to DSM we bring Debian Linux to the DiskStation
- We install openHAB in the Debian environment
Advantages: under Debian Linux, we can install any other programs that are useful to us. And we can set up openHAB exactly as we need it. Let's go.
Installing Debian on the DiskStation
- Go to the Package Center in the DSM web interface and click Settings and select the Package Sources tab
- Add a new package source, enter SynoCommunity as name and http://packages.synocommunity.com/ as location
- Now you will find the Debian Chroot package at the Package Center, install it
From now on we move to the Linux command line. Use SSH to log into your diskstation (if you have never done that, don't worry, here is a brief guide and recommendations for Mac and Windows ). Please note: You must first log in as admin using your administrator password. Then you change to the user root (which has the same password) using the following command:
- sudo su -
Now you switch to the Debian environment of the DiskStation:
- /var/packages/debian-chroot/scripts/start-stop-status chroot
First, we update the newly installed Debian by updating information about software packages and then updating the software packages themselves:
- apt-get update
- apt-get upgrade
Next adjust your regional settings:
- apt-get install debconf
- apt-get install locales
- dpkg-reconfigure locales
If you are unsure which option to select, choose the UTF8 variant for your language. Now we have running Debian on the DiskStation with a base configuration. Of course you can set up and configure even more in Debian. But this is not necessary for openHAB at the moment, however if you are interested in it take a look at Mark's blog.
Now our basic system is ready and we come to our real goal: openHAB.
Installing openHAB in Debian
To run openHAB, we need Java. Therefore we add to our Debian system the source from which Java packages will be installed:
- echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
- echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
- apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
Now we can easily install Java:
- apt-get update
- apt-get install oracle-java8-installer
- apt-get install oracle-java8-set-default
When this has finished, we briefly check that Java works:
- java -version
If everything went well, we get an output similar to this one:
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode)
Using the same pattern, we are now installing openHAB. First adding package sources and then installing the openHAB Debian package:
- wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | apt-key add -
- echo 'deb http://dl.bintray.com/openhab/apt-repo2 stable main' | tee /etc/apt/sources.list.d/openhab2.list
- apt-get update
- apt-get install openhab2
If you later need to install extensions for OpenHAB for your special SmartHome devices, they will be downloaded from the Internet as required. If you want to disconnect your system from the Internet, you can now install all extensions (usually you can skip this step):
- apt-get install openhab2-addons
Now we can start openHAB:
- service openhab2 start
[Ok] Starting openHAB2 server: openhab2.
The first start may take a while, even a few minutes. How to start openHAB automatically (e.g. when the DiskStation reboots or openHAB quits unexpectedly) I will show you in another article. You can check if openHAB is now running by opening a browser and going to http://<IP-address-the-diskstation>:8080 so eg http://192.168.172.50:8080 or if the diskstation can be addressed by name in your home network use http://diskstation:8080 . You should now see the following:
Now choose how you want to set up openHAB. I recommend choosing one of the following options (if you are unsure, choosing Standard won't be a mistake):
Standard - this is the version recommended for most users. It contains
- Paper UI for system administration, including device management
- Basic UI as a new modern user interface for mobile devices
- HABPanel as a dashboard for (eg wall-mounted) tablets
Additional extensions can be installed later via Paper UI or directly through the definition in addons.cfg .
Expert - all those who have previously used openHAB 1.x or all who see themselves as power users should choose this version. You will get
- Everything the Standard package contains
- Classic UI the web interface of openHAB 1.x
- HABmin a powerful administration interface, especially for Z-Wave users
- Interactive REST API with which the REST functions can be tested
- All transformations as they were in openHAB 1.x
If you have also decided as I have for Standard , you will soon see the start page of openHAB. How do you start openHAP automatically on the diskstation eg after a reboot of the disk station or if openHAB was accidentally terminated, I show you in another article.
Don't want to miss anything?
Newsletter Subscribe Content