Raspberry Pi Home Automation: OpenNetHome Installation
Adrian Biffen, Senior Partner
The Raspberry Pi ® is a very affordable, credit-card sized SBC (Single Board Computer) that can be easily configured as a powerful home automation controller, using the OpenNetHome automation software.
As discussed in the previous article, it can also be used as a very effective general purpose computer.
This article will discuss the process of configuring the RPi as a home automation controller hub, using the OpenNetHome system.
This software runs in the background as a web server, controlling various devices in your home, including our shade/blind motors and window/skylight openers.
The OpenNetHome system does not depend on the cloud for operation, an important consideration when setting up an automation controller. It will control your home and greenhouse with or without an internet connection.
You can access it remotely over the Internet, if you decide you want that capability.
About OpenNetHome Design Philosophy
OpenNetHome is open source and the architecture is also open. Developed by Stefan Stromberg in Stockholm, Sweden, it is written in the Java programming language and runs on any platform, but often on the Raspberry Pi, which is the focus of this article series.
It is worth mentioning Stefan's design parameters because I personally think he got it exactly right:
- It must be able to mix hardware from different vendors – Home automation is still an immature field, and there are always new technologies emerging for control of lamps and appliances. It is important that you don’t get locked into a system and that the investments you made so far are not wasted when the next technology emerges.
- It must be portable People are changing platforms more often now, and a home automation server will live for years. You may start up by using your Windows HTPC, moving over to MythTV on Linux and then perhaps move it to your old MiniMAC.
- GUI must be WEB based A home automation server often ends up on an old server in a cupboard or a RaspberrPi and it must work without keyboard and monitor.
- It must be usable without having to learn a script language Ok, some people love to dig in to a new scripting language, but when it comes to home control it is nice to be able to just select what you want to happen when you press that button without getting a syntax error…
- It must be fast and easy to build in small steps Home developers know that most larger home projects end up half-finished. There is only a limited amount of time a normal person can put on this kind of hobby, and if something takes too long you will lose focus or interest. It must be possible to add functions in small incremental steps without having spend time writing GUI layout and other non functional stuff.
Feature List for OpenNetHome Automation Software:
- Can collect and graph data from thermometers and other sensors
- Weekly timer for scheduling reoccurring tasks within a week
- Timer that can set times relative to sunset and sunrise
- One shot timer for delaying or holding actions
- Receive and collect temperature and hygrometer data via the UPM wireless system
- Collect temperature values from the PC's internal temperature sensors
- Control appliances via powermid IR
- External TCP/IP-interface to all functionality
- External UDP/IP-interface to all functionality
- Specific WEB-interface for presenting thermometers
Before you start:
We prefer the Firefox browser for ease of use and stability; on the Pi it is called Ice Weasel due to some copyright issues.
If you want to install it, the first thing to do is to update your repository indexes; open the terminal and type the following:
sudo apt-get update (press ENTER, watch for prompts)
The above is something you can do periodically to keep your Pi in sync with the repositories. To install Ice Weasel, execute this:
sudo apt-get install iceweasel (press ENTER, watch for prompts)
When it has finished installing, you can access it through the Internet drop-down menu (click the raspberry icon, top left). You can also right click on the Ice Weasel icon to add it to the desktop. Launching from the desktop is accomplished by right-click OPEN.
When Ice Weasel has opened, you can activate the bookmarks toolbar by right clicking an empty area of the tab bar.
Installation Steps - OpenNetHome Automation Software on the Pi
The home automation package is installed directly from the OpenNetHome website with a few command line directives. You will use the built-in Terminal program to accomplish this; please see the Terminal program icon at the top of the Pi screen (assuming you have a default Raspbian installation as per part 2 of this article series).
1. Click the Terminal icon to open the Terminal program (instead of typing the following commands, you can copy/paste).
2. Type the following command, press ENTER (downloads the compressed software package from the server):
3. Type the following command, press ENTER (decompresses the software package):
4. Type the following command, press ENTER (creates folder where software will be installed):
5. Type the following command, press ENTER (sets the appropriate folder permissions so the program can run):
chmod +x *.sh (note the space between x and *)
6. Type the following command, press ENTER (installs the software into the folder):
INSTALL IS DONE!
Updating Steps - If You Already Installed OpenNetHome
1. Click the Terminal icon to open the Terminal program
2. Type the following command, press ENTER:
sudo nethome upgrade-nightly
This will download the latest compressed software package from the server and automatically update your Pi. Some of the steps it executes will take time, so if it looks like it has stopped, wait to see if it has completed. You should see a final message saying upgrade complete.
Running The Automation Software in the Raspberry Pi Browser
Now that you have it installed, the final step is to open the browser to view the program screen, using this address:
You can also continue to use your Pi for general computing purposes - this automation software runs in the background and does not require that the Pi be dedicated to it.
Use Any Web Enabled Device on your Local Network
It is important to understand that OpenNetHome is a web server, which means you can use any web enabled device in your home that is connected via WiFi or network cable to access the system - phone, tablet, desktop, laptop or whatever!
In order to do this, you will need to find out what the local IP address of the Pi is, and there are a couple of ways to do this.
The easy way is to just ask your Pi by entering this command in the Terminal program:
Another method is to open your router administration and look at the device list to determine the local IP of the Pi. You can disconnect the network cable of the Pi and watch for it to disappear from the list, then reconnect to get the IP address.
Once you have the IP address, you can access the system in any browser on your network with this address:
http://[ip address]:8020/home ( example: http://192.168.1.4:8020/home )
You can subsequently bookmark that location in your browser. We also configured our router to bypass DHCP and permanently assign that IP address to the Pi, which prevents it from popping up at a different local IP at some later time. There are many articles available on how to do this, search for assign static ip address in router.
When we reached this point, we put the Pi away in the cupboard as there is really no need to see it any longer.
Troubleshooting the NetHome Server Software
If you have difficulty, this command will give you the name of the latest log file that may have some clues to any problem you might be having. You can then use the file manager program on the Pi to find that file and open it with the text editor.
ls -l /var/log/nethome/
Please Note: Our blind motors and window openers are operated with wall mount and hand held controls, and our system is designed to allow automation to be added at any time. This means you can start with our simple remote controls and add the automation later, and take your time with it. Our remote controls will continue to function while you build your automation system and will also continue to function after the automation is activated.
You can find out where to buy the Pi 2 Model B unit by searching for this phrase: "buy a pi [country]"
Here are some examples using the DuckDuckGo search engine that doesn't track you:
We sincerely hope you enjoy these articles; if you have any questions, please feel free to contact us at any time!
PART 3: Raspberry Pi As A Home Automation Controller: Installing OpenNetHome Software (YOU ARE HERE)