How to install and configure openHAB su Windows

7 minutes of reading
Guide purposes
Concepts dealt with:
  • software installation and configuration
Software components used:
Prerequisites
  • Wifi network connected to the Internet
  • Operating System Windows working
Physical devices used:
  • Computer with operating system Windows
Notes and disclaimer
  • qualsiasi eventuale modifica agli impianti domestici dev'essere progettata ed realizzata SOLO da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (the contents of the present page are purely educational);
  • any changes implemented in proprior to a device it voids the guarantee, quality approvals and certifications.

Abstract

As explained in other articles, openHAB is the one of the HUB ideal personal to make one profirst personal, organic and functional home automation. This software component has the ability to be installed on many systems and in different modes: although installation on Raspberry Pi is the most favored mode (for a thousand reasons, not least the need for an always-on system that consumes little or nothing), installation on Windows it is simple and ideal for those who want to perform a trial.

The complete list of installation guides for various operating systems is available on the index page dedicated to openHAB of our site.

Prosubsidence

zulu

First of all it is necessary to download the installation package of Java8of which we highly recommend the Zulu declination, which is available for free at the link https://www.azul.com/downloads/zulu/.

Install Java and JVM

The first operational step is to install Java and Java Virtual Machine.
  1. Check if you have the correct version of the Java platform installed on your computer. To check the installed Java platform version, open the system console Windows (typically, just type the command in the Start menu command line box cmd.exe) and from procommand mpt type:
     java -version

    If the Java platform is installed, the command will return a message similar to the following: |

    java version "1.8.0_121"
    Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
    Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode)

    It is important to verify that the installed platform is in release 8. OpenHAB does not work with 9 and 10 versions of Java.

  2. To achieve maximum compatibility with openHAB (myopenhab. Org e Eclipse IoT Marketplace) the minimum compatible revision of the Java 8 platform is the "161". In the example, the reported version is the "121".
  3. If the installed Java platform meets these requirements you can go directly toinstallation of openHAB.
  4. Download from the website of proconductor zulu, you can choose whether to use the format zip o msi:Zulu - 1 step installation
  5. install Zulu

    Using the file zip:

      1. copy the downloaded zip file (eg. zulu8.28.0.1-jdk8.0.163-win_x64.zip ) in a dedicated folder;
      2. unzip the copied file by clicking on the file with the right mouse button and select the "Extract here" item. At the end of proI will create a folder like this:

        C: \Program Files Zulu zulu8.12.0.1-jdk8.0.71-win_x64

    Using the file msi:

      1. double click on the file "<zulu-package> .msi";
      2. after welcome page it will come promail the destination folder (eg "C: \Program Files Zulu");
      3. after confirmation, the proinstallation process;
      4. at the end of the installation, accepting the path proplace, Zulu will have been installed inC: \Program Files Zulu zulu-8"
  6. add paths to the Zulu platform

    It is necessary to create one environment variable "JAVA_HOME ' associated with the Zulu installation path through the Control Panel di Windows (Control Panel> All Control Panel Items> System> Advanced System Settings> Environment Variables> New):

    1. Zulu - 2 step installation
  7. configured Zulu

Specify the size of the Java package: Use the command -Xmx + numeric value to define the size of the memory location reserved for zulu. (Eg. -Xmx 128mb)

Specify the Graphic Renderer. Starting from the 2.80 version the basic 2D Renderer set is Marlin. However it is possible to set the previous render - Pisces - as follows:

-Dsun.java2d.renderer = sun.java2d.pisces.PiscesRenderingEngine

Install openHAB

The installation package of openHAB for Windows comes with an archive file zip.

To install openHAB, prosell as follows:

  1. Download the version of openHAB choice (stable o snapshot) from the page download for free
  2. Unzip the zip file in the chosen directory (eg "C: \openHAB2")

openHAB - 1 step installation

Start the server. To do this run the file start.batand wait for the start and completion of the proprocedure:

openhab - 2 step installation

  1. Open the internet browser and type http://localhost:8080. The package selection page will be displayed openHAB. Once the ap package is selectedproonce this page will display the selection screen of the User Interface.

Once installation is complete, in the directory "C: \openHAB2"The following list of folders will be visible:

Applished here openHABC:\openHAB2\runtime
Add-onC:\openHAB2\addons
ConfigurationC:\openHAB2\conf
Log fileC:\openHAB2\userdata\logs
User databaseC:\openHAB2\userdata
Services configurationC:\openHAB2\userdata\etc

First start

At the first start of openHAB the system control panel is displayed.
To access - using an internet browser - just type in the following address:
http://<IP del vostro computer>:8080
The page that opens will be similar to the following:
openHAB - first start step 1
As you can see, you can choose between different options. For novice users we recommend the package "Standard". Selecting it will install the "Paper UI”(To install the Add-on, configure and connect Things, etc.), the “Basic UI”(Useful for having a mappa of your automation system) and the "Habpanel”(From which you can create interactive control panels for things on your system). Finished installing the package "Standard"The system redirects you to the start page.
openHAB - first start step 2
openHAB - first start step 3

Perform a Backup

It is always a good idea to make regular copies of folders conf e userdata. This will be useful when replicating the configuration of openHAB.

To make a complete backup of openHAB it is sufficient to make a copy - to be archived - of the folder “C: \openHAB2"

Update Searchnamento

At the time of writing this guide are not available proupdating cessationsnameautomatic payment for Windows. To manually perform the highernameof the runtime di openHAB, it is necessary to follow the following promanual cedar:

  1. Stop the proprocess openHAB, if running;
  2. Back up openHAB as previously described;
  3. Delete the following files and folders from the existing installation:
userdata\etc\all.policy
userdata\etc\branding.properties
userdata\etc\branding-ssh.properties
userdata\etc\config.properties
userdata\etc\custom.properties
userdata\etc\custom.system.properties
userdata\etc\distribution.info
userdata\etc\jre.properties
userdata\etc\org.openhab.addons.cfg
userdata\etc\org.ops4j.pax.url.mvn.cfg
userdata\etc\overrides.properties
userdata\etc\profile.cfg
userdata\etc\startup.properties
userdata\etc\system.properties
userdata\etc\version.properties

ogni file in userdata\etc che inizia per apache.karaf

la cartella userdata\cache
la cartella userdata\tmp
la cartella runtime
  1. copy and paste the contents of the zip file of the new version of openHAB in the existing installation directory, being careful not to overwrite existing files when propost.

configuration openHAB as a service

The configuration of openHAB as a service allows:

  • to start it automatically at system startup;
  • to execute the probackground process.

To configure openHAB as a service prosell as follows:

  1. complete the steps provided in the prerequisites and in the proinstallation certificate, including package selection;
  2. run the following two commands in the console openHAB:
feature:install service-wrapper
wrapper:install --name "openHAB2" --display "openHAB2" --description "openHAB 2 Service"

openHAB - 3 step installation

  1. stop the session openHAB typing the command "logout"In the finestof the console;
  2. update the configuration "C: \openHAB2 \ userdata \ etc \openHAB2-wrapper.conf” appena created to include all the necessary parameters in the following way:
    • copy all the configuration text from the following text and copy it inside “openHAB2-wrapper.conf", Replacing all existing content;
    • modify the instructions of the type ("OPENHAB_HOME") So that they coincide with the installation directory of openHAB implemented:
#*******************************************************

# openHAB2-wrapper.conf for Windows Service Installation

#******************************************************* 

# openHAB installation dir (Adapt this first setting to your system)set.default.OPENHAB_HOME=C:\openHAB2

# Wrapper Properties

set.default.OPENHAB_CONF=%OPENHAB_HOME%\conf
set.default.OPENHAB_RUNTIME=%OPENHAB_HOME%\runtime
set.default.OPENHAB_USERDATA=%OPENHAB_HOME%\userdata
set.default.OPENHAB_LOGDIR=%OPENHAB_USERDATA%\logs
set.default.KARAF_HOME=%OPENHAB_RUNTIME%
set.default.KARAF_BASE=%OPENHAB_USERDATA%
set.default.KARAF_DATA=%OPENHAB_USERDATA%
set.default.KARAF_ETC=%OPENHAB_USERDATA%\etc
set.default.PATH=%PATH%;%KARAF_BASE%\lib;%KARAF_HOME%\lib 

# Java Application

wrapper.working.dir=%KARAF_BASE%
wrapper.java.command=%JAVA_HOME%\bin\java
wrapper.java.mainclass=org.apache.karaf.wrapper.internal.service.Main
wrapper.java.classpath.1=%KARAF_HOME%\lib\boot\*.jar
wrapper.java.classpath.2=%KARAF_DATA%\lib\wrapper\*.jar
wrapper.java.library.path.1=%KARAF_DATA%\lib\wrapper\ 

# Java Parameters

wrapper.java.additional.1=-Dkaraf.home="%KARAF_HOME%"
wrapper.java.additional.2=-Dkaraf.base="%KARAF_BASE%"
wrapper.java.additional.3=-Dkaraf.data="%KARAF_DATA%"
wrapper.java.additional.4=-Dkaraf.etc="%KARAF_ETC%"
wrapper.java.additional.5=-Dcom.sun.management.jmxremote
wrapper.java.additional.6=-Dkaraf.startLocalConsole=false
wrapper.java.additional.7=-Dkaraf.startRemoteShell=true
wrapper.java.additional.8=-Djava.endorsed.dirs="%JAVA_HOME%\jre\lib\endorsed;%JAVA_HOME%\lib\endorsed;%KARAF_HOME%\lib\endorsed"
wrapper.java.additional.9=-Djava.ext.dirs="%JAVA_HOME%\jre\lib\ext;%JAVA_HOME%\lib\ext;%KARAF_HOME%\lib\ext"
wrapper.java.additional.10=-Dopenhab.home="%OPENHAB_HOME%"
wrapper.java.additional.11=-Dopenhab.conf="%OPENHAB_HOME%\conf"
wrapper.java.additional.12=-Dopenhab.runtime="%OPENHAB_HOME%\runtime"
wrapper.java.additional.13=-Dopenhab.userdata="%OPENHAB_HOME%\userdata"
wrapper.java.additional.14=-Dopenhab.logdir="%OPENHAB_USERDATA%\logs"
wrapper.java.additional.15=-Dfelix.cm.dir="%OPENHAB_HOME%\userdata\config"
wrapper.java.additional.16=-Dorg.osgi.service.http.port=8080
wrapper.java.additional.17=-Dorg.osgi.service.http.port.secure=8443
wrapper.java.maxmemory=512 

# Wrapper Logging Properties

wrapper.console.format=PM
wrapper.console.loglevel=INFO
wrapper.logfile=%OPENHAB_USERDATA%\logs\wrapper.log
wrapper.logfile.format=LPTM
wrapper.logfile.loglevel=INFO
wrapper.logfile.maxsize=10m
wrapper.logfile.maxfiles=5
wrapper.syslog.loglevel=NONE 

# Wrapper Windows Properties

wrapper.console.title=openHAB2
wrapper.ntservice.name=openHAB2
wrapper.ntservice.displayname=openHAB2
wrapper.ntservice.description=openHAB 2 Service
wrapper.ntservice.dependency.1=
wrapper.ntservice.starttype=AUTO_START
wrapper.ntservice.interactive=false
  1. da Windows, execute the finestra CMD.exe and type the following commands:
C:\openHAB2\userdata\bin\openHAB2-service.bat install
net start "openHAB2"

openHAB - 4 step installation

openHAB - 5 step installation

  1. Il servizio openHAB is now up and running. Check the proservice installation certificate:
    • Open the internet browser and type http://localhost:8080.
    • Check that Windows Service is running and set to Auto Start. Always from procommand mpt use the command services.msc and, in the finestthat the service will open openHAB2.openHAB - 6 step installation
    • Connect to the console using a SSH client (see below)

Connection to the console

The connection to the console openHAB you work using the script "C: \openHAB2 \ runtime \ bin \ CLIENT.BAT”On maclocal china. Alternatively you can use a SSH client standard, using the profollowing procedure:

  1. Install aapplished here SSH client (Putty, KiTTY, Xshell 5);
  2. Set up a session with the following parameters:
    • Host: 127.0.0.1
    • Port: 8101
    • Username: openhab
    • Password: habopen

openHAB - 7 step installationopenHAB - 8 step installationopenHAB - 9 step installationopenHAB - 10 step installation


inDomus telegram channel