So now it’s time to actually start the journey of home automation. As I mentioned in my last post, I’ll be using openHAB as the hub of my automation system. In this post I will show you how to install it.
OpenHAB is a program that, in a sense, is the “home automation powerhouse”. You can integrate all sorts of different nodes (temperature sensors, door locks, HVAC, Philips Hue, Alexa, etc) with it. You could use rules for your house to act in a specific way. Lets say you start watching a movie. A rule may be set up, that once a movie starts, openHAB dims the lights in the living room, sets the volume, any maybe doesn’t allow the robot vacuum to start cleaning if it were to do so. The wonderful thing is, the possibilities are almost endless. And there is always many different ways of doing one thing in openHAB, so if I do it one way, you can most certainly do it your way.
OpenHAB needs to run 24/7 to monitor what is going on and take action accordingly. So we need a computer to run it on. You could install it on many different systems. Your Windows, Mac or Linux PC. You could buy a used server from eBay and have it run in the corner. But all those systems have one drawback. Power consumption. If you run something 24 hours a day, every day, the power bill will add up. But one of my criteria is the system has to have low running cost. Que SBC’s (Singe Board Computer’s)!
Quick rundown on Single Board Computers
Over the last ten years single board computers have done a huge leap forward. You may have heard about Raspberry Pi. One of the most famous SBC’s today. And when doing some research you will find the list is absolutely huge. Besides Raspberry Pi (Rpi) there is OrangePi, BananaPi, Asus Tinker board, Odroid, Udoo, etc. But I won’t be using any of those.
I have chosen to use a board from Pine64. It’s a company that started in 2015 with their Kickstarter campaign for their first board, the Pine64. There’s a few different models now, the Pine64, Pine64+ and the Pine64 LTS,and the last is what I’ll be using. The LTS stands for Long Term Support and Pine64 have committed to support the board to at least 2022.
OpenHAB community has ported the OpenHabian, that was meant for Rpi, to the Pine64 , but unfortunately its for the 64 and 64+ models. The LTS is slightly different and thus, the image won’t run on it. So , instead I have chosen the Armbian image for the 64 LTS and installed all the required dependencies for openHAB to run. OpenHAB on a Pine64 – that is how PineHAB was born !Download PineHAB here!
Using PineHAB – an openHAB image on a Pine64
After downloading, all you need is to burn the image on your SD card (4Gb minimum and a class 10). For that I use Etcher, witch is a great tool for that. If you are on Windows, you could also use Win32DiskiImager, or if on Mac or Linux, the dd tool in the terminal. If you don’t have any of these tools set up already, I would recommend going with Etcher.
Once the image is burned to the SD card, insert it to the card slot on the Pine64 board, connect the ethernet and power cable and power up the board. The first boot will take a few minutes. A script that comes with Armbian resizes the root file system to use all of the available space and also runs through the first boot script that changes the SSH key, so you could safely log in.
After a few minutes have passed, we can try to log in via SSH. If on Mac or Linux, ssh client comes with your OS and you can use it from your Terminal window. On Windows, a very popular tool is Putty. For Putty installation on Windows, go here.
But there is an SSH client built in Windows. To enable it, go to Settings>Apps>Manage Optional Features , scroll down and find OpenSSH client.
To log in, you’ll need to know the local IP address of your machine. For that you can look it up by logging in to your router or you could use a program called AngryIPScanner. To find out more about AngryIPScanner go here.
Change the default passwords!
Now that you know your machines IP, go ahead and try to log in. The default root password is root1234, the users (pinehab) default password is pinehab1234 and the same goes for Samba and Mosquitto defaults. Once logged in, lets go and change the root, user, Samba (file sharing) and Mosquitto (MQTT server) passwords.
For root password you’ll need to be logged in as root. Then type passwd and the system will prompt you to enter a new password. To change the user password you type passwd pinehab and enter a new password for user.
To change Samba password you’ll need to type smbpasswd -a pinehab. If you are logged in as user then just add sudo in front of the code. And again, the system will ask you to enter a new password.
For Mosquitto type mosquitto_passwd -c /etc/mosquitto/passwd pinehab.
Now you are ready to use PineHAB!
Samba on for Linux users
If you are a Linux user, you need to install Samba on your system to access the openHAB folders. To do that open your terminal and type sudo apt-get install smbclient and let the computer do it’s thing. Once Samba client has finished installing, open you file browser, go to Network and on the address bar type smb://<IP_ADDRESS>. Where the IP_ADDRESS is your device’s IP. You should see two folders, $print and pinehab. Double click on pinehab and you will be prompted with a dialog box. Choose Registered and fill out the following details. User:openhab, Workgroup:WORKGROUP and password: the password you chose for Samba.
On Windows, open your file browser, go to Network and select PINE64SO. The user and password are the same as with Linux. User: openhab , Password: pinehab1234.
If everything goes correctly, you now have access to openHAB files which you can modify to make your house come allive!
And that is it for this post. We have our openHAB system up and running and we can start diving further into the world of home automation. If you have any questions feel free to comment and I will do my best to answer them.
In the next post I will talk about how to configure openHAB and what is the easiest way to do so.
Hope this article was helpful and that you enjoyed it.
If you have any questions, leave them below in the comments section and I will do my best to answer them.