0

members

Easy Raspberry basics: Project 29m Raspberry PI 3 model B board - OpenHAB2 for beginners

of Acoptex.com in Raspberry Pi 3

Raspberry basics: Project 29m

Project name: Raspberry PI 3 model B board - OpenHAB2 for beginners

Tags: Raspberry, Raspberry PI 3 model B board, vers 1.1, v 1.1, openHAB2, openHAB 2, how to install openHAB 2 on Raspberry Pi, openHAB for beginners

Attachments: none

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1.Raspberry PI 3 model B 1 pc

2. Micro SD card and SD card adapter 1 pc


3. Micro USB power supply (2.1 A, max 2.5 A) 1 pc

4. USB keyboard 1 pc

5. USB mouse 1 pc

6. TV or PC monitor 1 pc optional

7. HDMI cable 1 pc optional

General

We will learn how to install openHAB 2 on Raspberry Pi 3 model B board.

Understanding the openHAB 2

openHAB runs on your hardware, doesn't require any cloud service to work, keeps your data privately at home and talks directly to your local devices whenever possible.

Integrations are available for the most popular cloud-based smart home platforms, including Google Assistant, Amazon Alexa, Apple HomeKit and IFTTT. Use the openHAB Cloud connector with the free myopenhab.org service or host your own.

openHAB is built upon the Eclipse SmartHome framework, an industry-grade IoT framework for the household backed by the Eclipse Foundation .It is actively maintained, absolutely vendor-neutral and will never lock you in.

Because of its low price, its small form factor and the low energy consumption, the Raspberry Pi is a quite popular platform for openHAB. It is favored amongst existing users and a recommended choice for newcomers.

openHAB 2 is fully written in Java. As such, it only depends on a Java Virtual Machine, which is available for many platforms. openHAB can be executed on different versions of macOS and Windows and many different variants of Linux (Ubuntu, Raspbian, ...).

Why openHAB?

  • Integrate Everything. With its pluggable architecture openHAB supports more than 200 different technologies and systems and thousands of devices!
  • Automate with Ease. Use a powerful and flexible engine to design rules, with time and event-based triggers, scripts, actions, notifications and voice control.
  • Runs Everywhere. Run your server on Linux, macOS, Windows, Raspberry Pi, PINE64, Docker, Synology... Access it with apps for the web, iOS, Android and others.

Features:

The following features are provided by the openHABian images out of the box:

  • Hassle-free setup without a display or keyboard, connected via Ethernet or Wi-Fi
  • openHAB 2 in the latest stable version
  • Zulu Embedded OpenJDK Java 8
  • openHABian Configuration Tool including updater functionality
  • openHAB Log Viewer (based on frontail)
  • Samba file sharing with pre-configured to use shares
  • Useful Linux packages pre-installed, including vim, mc, screen, htop, ...
  • Login information screen, powered by FireMotD
  • Customized Bash shell experience
  • Customized vim settings, including openHAB syntax highlighting
  • Customized nano settings, including openHAB syntax highlighting
  • Raspberry Pi specific: Extend to the whole SD card, 16MB GPU memory split

Understanding the Raspberry PI 3 model B

The Raspberry Pi 3 is the third-generation Raspberry Pi. It replaced the Raspberry Pi 2 Model B in February 2016.

Specification:

  • Quad Core 1.2GHz Broadcom BCM2837 64bit CPU
  • 1GB RAM
  • BCM43438 wireless LAN and Bluetooth Low Energy (BLE) on board
  • 40-pin extended GPIO
  • 4 USB 2 ports
  • 4 Pole stereo output and composite video port
  • Full size HDMI
  • CSI camera port for connecting a Raspberry Pi camera
  • DSI display port for connecting a Raspberry Pi touchscreen display
  • Micro SD port for loading your operating system and storing data
  • Upgraded switched Micro USB power source up to 2.5A

Signals and connections of the Raspberry PI 3 model B


Step by Step instruction

We recommend using a high-performance SD card for increased stability as well as plugging your device into an external display to see the default application booting up.

We assume that you have Windows 7 64 bit OS installed on your PC, and empty micro SD card.

1. Installing openHAB 2

  1. Insert micro SD card in SD card adapter. We recommend at least a 32 GB SD card to avoid running out of space. 
  2. Insert SD card adapter to SD card reader in your PC or attached with cable to your PC' USB port.
  3. Go to openhab.org website and select the image for your device Raspberry Pi - stable 2.4.0. You can download it here. It's a preconfigured image for the Raspberry Pi, with the latest build of openHAB 2 and many useful software components (like Samba, Grafana or Mosquitto) as optional setup steps. The image provided by the openHABian projects is based on Raspbian and under constant improvement. The provided image is based on the Raspbian Lite standard system.
  4. Go to etcher.io website and download the Etcher on your PC for your OS (We have Windows 7 64 bits OS)
  5. When downloading completed, open Etcher (double-click on balenaEtcher-Portable-1.5.51.exe file) and click on Select image. Choose the image you've previously downloaded, for example we had openhabian-pi-raspbian-201908050414-gitca0976f-crc6a66b5a1.img.xz. Select the SD card and click on Flash! button. Please note that SD card must be formatted before doing this step. Wait a few minutes while Etcher flashes the image on the micro SD card.
  6. Do not remove the SD card adapter from SD card reader in your PC/laptop if you want to setup the WiFi connection. You will need to modify the openhabian.conf file. 
  7. Access the first SD card partition from the file explorer of your choice (e.g. Windows file explorer). Open the file openhabian.conf in a text editor (we used the Notebook++).
  8. Uncomment and modify two lines with your WiFi network data: wifi_ssid="My Wi-Fi SSID" and wifi_psk="My WiFi password". Save the file and take out your SD card adapter with micro SD card.
  9. Make sure that Raspberry PI 3 switched off.
  10. Insert the micro SD card with image to your Raspberry Pi 3 board.
  11. Connect an Ethernet cable to LAN' port of Raspberry Pi 3 board (or setup the Wi-Fi first).
  12. Plug in your USB mouse and USB keyboard to Raspberry PI 3 USB ports.
  13. Connect Micro USB power supply to Raspberry PI 3 board micro USB input.
  14. Wait between 15 and 45 minutes for openHABian to perform its initial setup. On first boot the system will set up openHAB and the mentioned settings and tools. All packages will be downloaded in their newest version and configured to work without further modifications. The whole process will take a few minutes, then openHAB and all other needed tools to get started will be ready to use without further configuration steps. openHABian is designed as a headless system, you will not need a display or a keyboard. (You can check the progress in your web-browser here).
  15. The device will be available under its IP or via the local DNS name openhab.
  16. If you need to find the IP address of our Raspberry Pi with openHab2 - check for new device on our router (look for openhab) or use the advanced IP scanner which you can download on advanced-ip-scanner.com website.
  17. You can access openHAB 2 dashboard on any PC/laptop/smartphone connected to the same local network. Type in any internet browser: http://openhab:8080 or http://IPaddress-of-your-raspberrypi:8080

  18. When starting openHAB for the very first time, you are asked to select an initial package to start with. If you skipped the package installation, the system stays in a minimal setup without any add-ons which also means without any UIs. In such a case, you must configure the add-ons to install in addons.cfg. We recommend to select the Standard Package (Recommended Setup). This is the package for the normal user. It contains the most common UIs and leaves the rest to the user to decide what else he needs: Home Builder as a getting-started generator for your home, Paper UI for system administration, including item access, Basic UI as the new modern web UI for mobile devices, HABPanel as a dashboard UI for (e.g. wall-mounted) tablets, additional add-ons can be installed through Paper UI or directly by defining them in addons.cfgExpert Package (Best for 1.x Users) is for all users coming from openHAB 1.x should choose this package. It contains everything that was part of the core 1.x runtime, plus the tools that are specifically meant for power users - Paper UI for system administration, including item access; Classic UI as the well-known web UI from openHAB 1.x; Basic UI as the new modern web UI for mobile devices; HABPanel as a dashboard UI for (e.g. wall-mounted) tablets; HABmin as a powerful administration console, specifically suited for Z-Wave setups; Interactive REST API that easily allows exploring the REST features through a documented UI; all available transformations as they used to be part of the core 1.x runtime. Simple Package (Purely UI) package contains only components that allow a fully UI-driven setup and configuration process - Paper UI for system administration, configured with "simple linking", i.e. no items are exposed to the user; the new rule engine to set up automation rules without scripting; HABPanel as a dashboard UI for daily use; only "native" openHAB 2 bindings are available, 1.x add-ons are excluded. Demo Package (Sample Setup) package is suitable for demo purposes and for quickly checking out openHAB. It not only installs a few common bindings, but also defines sample textual configuration files, which are also used on the public openHAB Demo Server. This includes: Paper UI for system administration, configured in "simple" mode, such that newly added Things directly become available on the control UIs; Basic UI as the new modern web UI for mobile devices; HABPanel as a dashboard UI for tablets; Bindings for Yahoo Weather, Belkin WeMo, Philips Hue, Sonos, IPP, Astro, AVM!Fritz and NTP; RRD4j persistence service for storing time-series locally; MAP transformation service as this is heavily used by the sample files; Sample configurations files demo.items, demo.things, demo.sitemap, demo.rules, demo.script, rrd4j.persist, de.map and en.map for use with the MAP transformation.
  19. After clicking on Standard, openHAB will install the packages and afterwards take you to the start page.

2. User interfaces (UIs)

openHAB offers different UIs in its standard configuration: the Paper UI, the Basic UI and the Classic UI (this has to be installed manually from within Paper UI or via config file).

  1. The Paper UI is an interface that helps setting up and configuring your openHAB instance. It does not (yet) cover all aspects, so you still need to resort to textual configuration files, but it already offers the following:
    Add-on management: Easily install or uninstall openHAB add-ons 
    The Paper UI is an interface that helps setting up and configuring your openHAB instance. It does not (yet) cover all aspects, so you still need to resort to textual configuration files, but it already offers the following: add-on management - easily install or uninstall openHAB add-ons; thing discovery - see devices and services found on your network and add them to your setup; linking items to channels -instead of adding a binding configuration to your item file, you can directly link Thing channels to your items. You still need to define your items, sitemaps, persistence configurations and rules in the according configuration files (as done in openHAB 1). Such functionality will be added bit by bit to the Paper UI only.

3. openHABian Configuration Tool

The openHABian Configuration Tool openhabian-config is included and provides the following optional settings and components:

  • Switch over to the latest Milestone or Snapshot release of openHAB 2 unstable/SNAPSHOT build
  • Install and Setup a reverse proxy with password authentication and/or HTTPS access (incl. Let's Encrypt certificate) for self-controlled remote access
  • Set up a Wi-Fi connection
  • Bind the openHAB remote console to all interfaces
  • Setup Backup for your system
  • Easily install and preconfigure Optional Components of your choice
  • And many more
  • Raspberry Pi specific: Prepare the serial port for the use with extension boards like Razberry, SCC, Enocean Pi, ... Move the system partition to an external USB stick or drive
  1. Once connected to the command line console of your system, please execute the openHABian configuration tool by typing the following command (Hint: sudo executes a command with elevated rights and will hence ask for your password: openhabian): sudo openhabian-config
  2. The configuration tool is the heart of openHABian. It is not only a menu with a set of options, it's also used in a special unattended mode inside the ready to use images. Use the cursor keys to navigate, to execute, to select and to jump to the actions on the bottom of the screen. Press twice to exit the configuration tool.
  3. Time Zone: The time zone of your openHABian system will be determined based on your internet connection. In some cases you might have to adjust that setting.
  4. Language: The locale setting of the openHABian base system is set to "en_US.UTF-8". While this setting will not do any harm, you might prefer e.g. console errors in German or Spanish. Change the locale settings accordingly. Be aware, that error solving might be easier when using the English error messages as search phrases.
  5. Passwords: Relying on default passwords is a security concern you should care about! The openHABian system is preconfigured with a few passwords you should change to ensure the security of your system. This is especially important if your system is accessible from outside your private subnet. All passwords can be changed from openHABian menu.
  • User password needed for SSH or sudo - username:openhabian and password:openhabian
  • Samba network shares - username:openhabian and password:openhabian
  • openHAB remote console - username:openhab and password:habopen 
  • Amanda backup password - no default, applied when installing
  • Nginx reverse proxy login - no default, applied when installing
  • InfluxDB - No password set by default
  • Grafana visualization - username:admin and password:admin

4. Optional Components

openHABian comes with a number of additional routines to quickly install and set up home automation related software. You'll find all of these in the openHABian Configuration Tool. 

  • frontail - openHAB Log Viewer accessible from http://openhab:9001
  • Mi Flora MQTT demon
  • InfluxDB and Grafana - persistence and graphing available from http://openhab:3000
  • Eclipse Mosquitto - Open Source MQTT v3.1/v3.1.1 Broker
  • Node-RED - "Flow-based programming for the Internet of Things", with preinstalled openHAB2 and BigTimer add-ons. Accessible from http://openhab:1880
  • Homegear - Homematic control unit emulation
  • KNXd - KNX daemon running at 224.0.23.12:3671/UDP
  • OWServer - 1wire control system
  • FIND - the Framework for Internal Navigation and Discovery
  • Tellstick core

After you got openHAB 2 set up and running, there are a few additional setup steps you should consider:

  1. Configure a network share on your openHAB host device and mount it locally: Linux Samba Share, Windows file sharing.
  2. Install Visual Studio Code and the openHAB VS Code Extension on your local machine, to manage your (remote) configuration files. The openHAB VS Code Extension comes with built-in support for the openHAB syntax and elements.

5. System Backup & Maintenance

When you have settled in how to use openHAB for your needs it could be a good moment to think about backup. Maybe you accedently delete something or the SD-card wearout which is a common on many single board computers such as Raspberry Pis.

There are four measuers and methods included to cover this matter today but they all need some reaserch and readup to be used. (Hopfully will a more streamlined method be developed in the future which better integreted with openHAB itself, keep tuned.)

  • Use openHAB integrated backup tool.
  • Move the root filesystem to an external USB-memory. [Menu option:37]
  • (BETA) Reduce wear on SD-card by move write intensive actions temporary to RAM during operation (logs,persistant-data). Warning: powerfailure will result in lost data. [Menu option: 6A]
  • (Advanced) Use Amanda Network Backup for full-system backup, longer introduction here. [Menu option: 51]

Summary

We have learnt how to install openHAB 2 on Raspberry Pi 3 model B board.

Libraries in use

  • None

Resources

  • See on the begining of this project


Other projects of Acoptex.com

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 25-08-2019
Viewed: 1747 times