Openhabian with Raspberry Pi – Part 1: Installation of openHABian on the Raspberry Pi 3
The holiday season in december is traditionally the time in year when I try to finish the projects I started over the year :-).
This december I want to finish the installation and configuration of my Rasberry Pi 3 together with openHAB 2 and openHABian.
OpenHAB is a great software that is vendor independent and allows you to control a lot of different smart home devices. It acts as the brain of your smart home environment. To ease the installation and use of openHAB the team behind openHAB has created a distribution that includes openHAB and all required components to start.
This series of blog posts describes the steps to install and configure a openHAB 2 installation and use it to control the following devices:
– Philips Hue bulbs
– Philips Hue light stripe
– Xiaomi Vacuum 1
– LG TV
– Vu+ DUO2
– Marantz 1603
– XBOX One
And of course I want to control those devices with my Amazon Echos aka Alexa and voice commands.
The series is divided into the following parts:
Part 1: Installation of openHABian on the Raspberry Pi 3
Part 2: Configuration of openHAB
Part 3: Adding Hue devices to openHAB
Part 4: Adding Logitech Harmony Hub and the living room devices to openHAB
Part 5: Adding Xiaomi vacuum cleaner type 1 to openHAB
Part 6: Adding voice control with Alexa
This is part 1 of the series. In this part I will describe the installation and network configuration of openhabian on my Raspberry Pi3.
Part 1: Installation of openHABian on the Raspberry Pi 3
I bought a Raspberry Pi 3 starter kit on Amazon:
Included in this kit is the Raspberry Pi 3, a 16 GB Micro SD Card, a Case for the Raspberry, a power supply, a heat sink and a HDMI cable to connect the Pi to a monitor or TV. I assembled the parts and got a copy of the openHABian Image from the following URL:
Use the link to the newest release notes and images:
At the time of writing the current release was openHABian 1.4. Download the Raspberry Pi Image from the download site and save it to your computer:
The Image file is compressed so you have to expand it before you can use it. I use 7-Zip to expand the Image file. The file should have the file extension .img after you have expanded it.
Write the image to the SD card
I used Windows 10, a UGREEN USB card reader and the Etcher application to write the image file to the SD card. Insert the SD card into the card reader, download and start Etcher and select the openHABian image file you have downloaded and expanded before. Use the SD card as destination for the image and start the write process with the “Flash!” button.
Frist boot of Raspberry Pi
Insert the SD card into the Raspberry Pi 3 and connect the Pi to the power supply, the network and (if you want) to the monitor and keyboard. My Pi looks like this when all cables are plugged in (you also see my connected mouse even when I do not use it):
The Pi should start and display boot messages. After the boot process has completed you should see the login screen:
Login to the console
You can login with the openHABian default login username and password openhabian/openhabian:
If the login was successful you should see some hardware and utilization information about the Pi, a short description for the first actions and the shell prompt.
If you don’t like the default password of the openhabian user you could change it now with the following command:
This will change the password of the current user. You first need to provide
the current password (openhabian) of the user and then two times the new password. The change will take effect immediately and you can use the new password the next time you login by console or SSH.
Login without keyboard and monitor
If you have no monitor and keyboard connected you can also login to the Pi via SSH but you need to find the IP address of the Pi first. The network configuration of the Pi is set to DHCP by default so your DHCP server should contain an entry for the Pi. You could also create a DHCP reservation and restart the Pi so you make sure the Pi always gets the same IP. If you don’t like this approach have a look a the next section where I give instructions how to set the Pi to a static IP configuration.
I use Putty as SSH client under Windows. Download and start it. Enter the IP address of the Pi and click on “Open”. Putty should establish the connection and show the login prompt. Enter the same default login credentials as for the login via console, openhabian/openhabian.
Change IP configuration
If you want to set a static IP configuration for the Pi you need to edit the file /etc/dhcpcd.conf.
To do so please connect to the Pi via SSH or the console and logon as openhabian/openhabian. We need elevated rights to save changes in the file /etc/dhcpcd.conf so we have to start the text editor nano with the sudo command like this:
sudo nano /etc/dhcpcd.conf
The system asks for the password of the openhabian user again so please type it in and hit enter.
The file opens and we can insert out static IP address configuration in section ‘# Example static IP configuration”. I use the following configuration at home:
interface eth0 static ip_address=192.168.35.245/24 static routers=192.168.35.254 static domain_name_servers=192.168.35.35 192.168.35.18
identifies the network card that should use our IP configuration.
contains the IP address you want to use with the subnet mask (/24 = 255.255.255.0) behind the IP address.
sets the default gateway to reach the other subnets and the internet.
The last line
sets the DNS servers which should be used by the Pi.
If you are done with your changes press the key combination Ctrl + x to exit the text editor. If the file was changed nano asks if the file should be saved. Answer the question with “Y” and enter.
Now the file is changed but the Pi uses the old IP configuration until you reboot it or restart the network with the following command:
sudo /etc/init.d/networking restart
If you are connected via SSH and you have changed you IP configuration your session will end and you need create a new session with the new IP address.
You can test the new configuration by pinging the Google DNS server with the following command:
If you get a response for the ping you know that the connection to the internet is ok. Next you could try to ping the Bing website with the following command:
If this also works the DNS resolution is also ok. If you have trouble with one or both tests please check your network configuration and make sure your ping packets are not blocked by the firewall of your internet router.
Update the Pi
To install the latest updates for the Pi use the following commands:
sudo apt update && sudo apt upgrade
This will update the information about new software updates and the start the upgrade process. If new upgrades are found you need to confirm the installation with enter.
This completes our first part of the blog post. Please read the next part of the series where I describe the first configuration of openHAB.