25 KiB
layout |
---|
tutorial-beginner |
{% include base.html %}
openHAB2 Raspberry beginner’s walkthrough – (Using Raspberry Pi 3 with openHAB2 and Z-Wave, WiFi LED, Samsung TV and YahooWeather bindings for a home automation project)
Chapter 1: Before you start
Is openHAB2 the right choice for my home automation project?
Be aware that openHAB2 is an OPEN home automation solution which is strongly living from a very supportive community. If you want to have a plug and play solution with supplier guaranteed service level and a high likeliness that all the features are working and all the hardware is compatible, you might be better off in getting a ready to use home automation kit including the designated controller (like e.g. devolo or homematic IP). Consider this especially if you are planning to do safety related automation or emergency detection like fire alarm. If you, on the other hand, are willing to spend a few hrs/days in learning how to do a little installation and coding yourself and have no problems with the service level of a Raspberry Pi 3 (it is not as failsafe as other controllers) you might find a perfect environment with openHAB2 for your low cost, very flexible and continuously improving home automation environment.
Introduction:
This tutorial is targeting beginners like me to get a step by step guideline to get all the things installed. Since I am no coding expert and have no experience in Raspberry and Raspbian I am trying to go through the things step by step, so you should be able to get everything done, even without exactly having to go into all the details. That is one of the reasons I am also using the graphical GUI PIXEL for Raspbian since I thing it makes it easier for the beginners to get started (and you might want to use PIXEL anyway when you are using the Raspberry 7” display as interface for your home automation controller) This tutorial is also based on having a Windows PC to support the setup process. You might be able to completely do it without the support of an extra PC, if you can get a MicroSD card with a pre-installed Raspbian OS and use the display options (the Raspberry 7” display or HDMI Display) for the Raspberry.
DISCLAIMER: This tutorial might contain some typos, errors or ways of setting up, which can be done in a better way. I am just reflecting my process of starting from scratch and slowly working my way through hundreds of online tutorials, manuals, forum threads etc. and on the way, highlighting the issues I had in getting things working. There will be no guarantee that the given instructions are working for your project as well.
Anyway I hope this tutorial will help some beginners to enjoy home automation with openHAB2.
A few words about the 2 in openHAB2:
The 2 in openHAB2 is important! The tutorial is based on the openHAB2 and will not go into all the details of the old version. You just have to be aware, that a lot of online documentation is still for the openHAB version and will not be applicable for openHAB2! So the best thing is always to go to the official webpage of openHAB2 and start from there, and only if you really can’t find the information or the link there, go to google and search for other solutions. I was always using the search setting (last year) so it was more likely to the results considering openHAB2 and not openHAB.
Chapter 2: Preparation
Shopping list: As mentioned before, I am basing this tutorial on the graphical GUI of Raspbian named PIXEL so the shopping list is also containing parts for this optional setup:
Minimal hardware setup of the controller with external display:
Additional hardware for optional setup of the controller with 7” Raspberry display:
(I found it very useful to have one permanent GUI interface mounted on your controller, you can also use this touchscreen interface directly to interact with your home automation):
Z-Wave Controller hardware
If you want to use the Z-Wave technology for your home automation project you have to have one Z-Wave controller connected to your Raspberry NOTE: Be aware that the details serial numbers or item names may vary since you have to always make sure to use the hardware which is allowed in your country!
Z-Wave sensors, switches and actuators
NOTE: Be aware that the details serial numbers or item names may vary since you have to always make sure to use the hardware which is allowed in your country! Since I am doing a German based home automation project you may find that some Z-Wave devices are not sold in your required country configuration ( e.g. Z-Wave NodOn Smart Plug not available e.g. in the US)
NOTE: If you want to by other Z-Wave devices always make your they are listed in the Z-Wave device list of the openHAB2 Z-Wave binding to make sure they are supported correctly in the context of openHAB2: http://www.cd-jackson.com/index.php/zwave/zwave-device-database/zwave-device-list
LAN devices (cable or WiFi) A lot of things you are using at home are already connected to your LAN and can be integrated into your openHAB2 home automation project if the right binding is available for that device. You can find an overview on http://docs.openhab.org/addons/bindings.html
NOTE: Be aware that not all the bindings to include devices are already included in the stable version of openHAB2 and may require a manual installation of a so called snapshot version of the binding (how to install snapshot bindings is explained later in this tutorial since we will need it for the WiFi LED controller)
Software list:
My tutorial is using a MS-Windows windows machine for the PC part (You should be able to get it done with Mac or Linux PCs as well, but you have to go online to look up the differences and do some adaptions on the tutorial e.g. mounting the Raspberry file system to PC)
Windows Download list:
Description | URL |
---|---|
The latest Raspbian (Raspberry OS) image. You have to download the “Raspbian Jessie with PIXEL - Image with PIXEL desktop based on Debian Jessie” since this tutorial is using PIXEL | https://www.Raspberrypi.org/downloads/Raspbian/ |
Etcher (to write the Raspbian image to the SD-Card) | https://etcher.io/ |
Eclipse Smart HomeDesigner (optional but strongly recommended for easy editing of OpenHAB2 configuration files; incl. syntax highlighting) You have to choose the right version for your PC | https://www.openhab.org/downloads.html |
To use Eclipse Smart HomeDesigner you need Java Runtime Environment JRE (if not already installed on your PC) | https://java.com/ |
PuTTY or KiTTY portable to access the Raspberry console from your PC | http://www.putty.org/ or https://portableapps.com/apps/internet/kitty-portable |
WinSCP portable to access Raspberry file System directly from your PC (might become obsolete if you use a SAMBA server on your Raspberry, see tutorial) | https://winscp.net/eng/download.php |
Raspberry downloads:
How to download software will be explained in the tutorial, but as a reference you will use:
- openHAB2 Package repository based installation or manual installation (be aware that the file locations on the Raspberry will be different based on which kind of installation you choose)
- Samba server(for access of Raspberry files from Windows machine; needed for Eclipse Smart HomeDesigner)
- xscreensaver (optional if you are using the display setup, to easy control screen blackening or screen savers)
Chapter 3: Raspberry hardware and Raspbian OS installation
General information about Raspberry interfaces and GPIO pins:
Raspberry input Overview:
Raspberry GPIO pin Overview:
Preparing MicroSD card - writing Raspbian image to MicroSD card (PC required):
Connecting the hardware to the Raspberry
Basic hardware setup:
Optional: Installation of 7” Raspberry display and display case:
The full tutorial will be found on:
https://www.element14.com/community/docs/DOC-78156/l/Raspberry-pi-7-touchscreen-display and a clip on YouTube:
https://www.youtube.com/watch?v=tK-w-wDvRTg
Remark: I had an issue with plugging in the power supply to the micro USB power input on the circuit board of the display (like shown in the video). The Raspberry was still showing me the low power symbol (lightening symbol on the upper right corner) SOLUTION: I had to plug in the power supply to the micro USB power input on the Raspberry itself. The display is now powered via the jumper cables. The standard display case is also allowing for both micro USB power inputs to be used.
NOTE: If the image on the display is having the wrong orientation, you can rotate the image by changing the configuration of Raspbian (see tutorial section Initial configuration of Raspbian)
Display installation pictures:
Description | Image |
---|---|
Step 1 | |
Step 2 | |
Step 3 | |
Step 4 | |
Step 5 | |
Step 6 | |
Step 7 | |
Step 8 | Assembly of the standard display. (Make sure you have inserted the MicroSD card since you won’t have access to the slot as soon as you mounted the case!)Just pull the back plate off the case, insert the display including the mounted Raspberry (make sure that the path cables and the display cables are not crushed between case and board), tighten it with the 4 screws and put the back plate into place. Here is a good clip on YouTube: https://www.youtube.com/watch?v=wpSxibZOmoo |
Chapter 4: Raspbian basic configuration
Starting up Raspberry or the first time – Raspbian PIXEL desktop
Since this tutorial is focussing on using the PIXEL GUI here are a few basic tips.
Raspberry start-up screen:
PIXEL basic desktop (including the programs used in this tutorial) not unlike other PC OS desktops:
NOTE: If you are working with the 7” Raspberry display setup you might need to flip/rotate the display orientation. Just check the section” Optional: Change display orientation” later in this chapter
Working with the Terminal:
NOTE: As soon as you have connected the Raspberry to the network you might find it easier to open the Terminal remotely using PuTTY. This also allows you to directly paste command lines from this tutorial into the Terminal. (Right click in PuTTY terminal is pasting the content of the clipboard into the terminal)
Basic terminal commands and functions:
The full list can be found on: https://www.Raspberrypi.org/documentation/linux/usage/commands.md
Command | Description |
---|---|
help |
Is showing you basic commands |
sudo *othercommand* |
is allowing you to run other commands as super user aka root user |
ls -la |
Shows the files in a directory incl. additional information |
cd |
Is changing the shell working directory. It can be used with attributes |
cd |
No attribute => working directory is changed to user root directory. |
cd .. |
Working directory is changed to directory one level above |
cd *directory* |
Working directory is changed to the named directory inside the current directory |
cd */directory/directory* |
Working directory is changed to the directory defined by the full path /directory/directory |
nano *filename* |
Is stating a basic editor in the terminal to open or create a simple text or configuration file. Closing the editor is done by ctrl+x and then choosing whether you want to save your changes or not |
sudo nano *filename* |
Is stating a basic editor with write access in the terminal to open or create a simple text or configuration file with root user rights. Closing the editor is done by ctrl+x and then choosing whether you want to save your changes or not |
Initial configuration of Raspbian
The following steps make sure, that basic Raspbian configuration is done.
NOTE: There may be many tutorials in how to set-up and configure Raspbian and going into more details about user rights and other Raspbian features. This tutorial is showing the way which worked for my project aiming to run openHAB2 on the Raspberry. Since this tutorial is using the PIXEL GUI I always refer to the PIXEL way of configuring and only go back to the terminal way (text only) if it is required.
Localisation:
The 1.st thing you want to do is changing the localisation settings to make sure your keyboard layout and WiFi settings are matching.
NOTE: Do not change the password before you have changed the keyboard layout since you might put in a different password than you expect (e.g. US qwerty vs. German qwertz results in “Raspberrz” instead of “Raspberry”)
Optional: Change display orientation
If you are working with the 7” Raspberry display setup you might need to flip/rotate the display orientation for specific cases
Changing Password:
This is important to secure your standard Raspberry user “pi” before you connect the Raspberry to the network.
NOTE: Make sure you have changed the keyboard layout to your requirements before change the password.
Enabling interfaces:
This is required for the communication to the PC (SSH) and to the Z-Wave stick (Serial)
Connect Raspberry to network:
Either by plugging in a Ethernet cable or by connecting to a WiFi network:
Description | Image/Command |
---|---|
Click on the network symbol | 3 lines and 2 red crosses if no connection is available |
Select WiFi network | [yourwifi] |
Enter WiFi password | yourwifipassword |
Check the IP address of the Raspberry:
To do so you have to check the IP address of the Raspberry in the terminal
Update / Upgrade Raspbian:
Raspbian is proving online updates so make sure that you have the latest installed before you go further in the configuration.
Markdown syntax examples start from here:
General header
Github specific syntax
Fenced Code
Fenced code bash highlighting
Strikethrogh
- Tasklist
- Tasklist
Header 1
Header 2
Header 3
Header 4
Header 5
Header 6
Strong-Bold
Emphasize
inline code
Blockquote
Blockquote
Blockquote
- Ordered List
- Ordered List
- Unordered List
- Unordered List
Page Break before
Page Break after
Section Break before
Section Break before
Sentence Break before
Sentence Break before
column | column | column |
---|---|---|
left | centered | right |
- | - | - |
text | picture |
---|---|
blabla |