-
Notifications
You must be signed in to change notification settings - Fork 0
IDE Setup
How to set up a development environment for openHAB
If you are a developer and not a pure user yourself, you might want to setup your Eclipse IDE, so that you can debug and develop openHAB bundles yourself. There are three options for getting the IDE running: yoxos, pure eclipse and vagrant.
- Create a local clone of the openHAB repository by running "git clone https://github.com/openhab/openhab" in a suitable folder.
- Download and install oracle jdk 1.7
- Download and install the Yoxos Installer.
- Download and execute the file openHAB.yoxos (in linux that can be done via command line ./yoxos openHAB.yoxos ). This will install you an Eclipse IDE with all required features to develop for openHAB. Alternatively, you can install all required plugins on top of an existing Eclipse 4.4 installation using this update site or download a full distribution from Yoxos, if you register an account there.
- Create a new workspace.
- Choose
File
→Import
→General
→Existing Projects into Workspace
, enter your clone repository directory as the root directory and press "Finish". - After the import is done, you have to select the target platform by selecting
Window
→Preferences
→Plug-in Development
→Target Platform
→openHAB
from the main menu. Ignore compilation problems at this step. - Now you need to run code generation for a few parts of openHAB. To do so, go to the project org.openhab.model.codegen and run the prepared launch files. For each .launch file, select
Run As
→x Generate abc Model
from the context menu. Please follow the order given by the numbers. On the very first code generation, you are asked in the console to download an ANTLR file, answer with "y" and press enter on the console. (See https://groups.google.com/forum/#!topic/openhab/QgABTJAkHOg if you're getting "Could not find or load main class org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher"). If step (3) fails with a CompliationException go Window -> Preferences -> Java -> Compiler and make sure JDK Compliance level is at least 1.6. - All your project in the workspace should now correctly compile without errors. If you still see errors, mark all projects and issue a project refresh (not by
F5
but using the context menurefresh
). If you still see error markers, try a "clean" on the concerned projects. If there are still errors, it could be that you use JDK 1.6 instead of JDK 1.7, or the JDK compliance is set to 1.4 or 1.5 instead of at least 1.6. - To launch openHAB from within your IDE, go to Run->Run Configurations->Eclipse Application->openHAB Runtime (resp. openHAB Designer). Switch to "Plug-in Development" perspective first (Windows->Open Perspective->Other->Plug-in Development).
To produce a binary zip yourself from your code, you can simply call mvn clean install
from the repository root and you will find the results in the folder distribution/target (you will of course need a Maven 3.0 installation as a prerequisite). Create Environment Variable MAVEN_OPTS
and set it to -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m
in order to avoid memory problems during the build process.
To run a single test you have to use following command: mvn -o org.eclipse.tycho:tycho-surefire-plugin:0.18.1:test
which activates the tycho-surefire-specific goal for OSGI unit test using the fragment bundle xxxx.test on xxxx bundle. The maven -o (offline) option accelerates the project dependency resolution by 10-20x since it lets maven search it's local repository. Normally, snapshot-enabled projects are using external repositories to find latest built packages.
- Create a local clone of the openHAB repository by running "git clone https://github.com/openhab/openhab" in a suitable folder.
- Download and install oracle jdk 1.7
- Download and install the Eclipse for RCP and RAP Developers.
- Create a new workspace.
- Choose
File
→Import
→General
→Existing Projects into Workspace
, enter your clone repository directory as the root directory and press "Finish". - After the import is done, you have to select the target platform by selecting
Window
→Preferences
→Plug-in Development
→Target Platform
→openHAB
from the main menu. Ignore compilation problems at this step. On this step Eclipse needs some minutes to load all the files for the target platform. I'ts very important to wait with the next step until Eclipse is finished with this step. - Download and install Maven 3. Set
MAVEN_OPTS
to-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m
in order to avoid memory problems during the build process. - Execute
mvn clean install
from the repository root. You will find the (binary) results in the folder distribution/target. On the very first code generation, you are asked on the console to download an ANTLR file, answer with "y" and press enter on the console. (See https://groups.google.com/forum/#!topic/openhab/QgABTJAkHOg if you're getting "Could not find or load main class org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher"). - All your project in the workspace should now correctly compile without errors. If you still see error markers, try a "clean" on the concerned projects. If there are still errors, it could be that you use JDK 1.6 instead of JDK 1.7, or the JDK compliance is set to 1.4 or 1.5 instead of at least 1.6.
- To launch openHAB from within your IDE, go to Run->Run Configurations->Eclipse Application->openHAB Runtime (resp. openHAB Designer). Switch to "Plug-in Development" perspective first (Windows->Open Perspective->Other->Plug-in Development).
After the first successful local build it might be a good idea to build with maven -o (offline) afterwards. This option accelerates the project dependency resolution by 10-20x since it lets maven search it's local repository. Normally, snapshot-enabled projects are using external repositories to find latest built packages.
Note that the IDE being installed by the above mentioned method does not contain any code generation facilities (MWE, Xtext) itself since that setup caused difficulties on certain machines. The code generation is accomplished through the maven build though.
Alternatively, you may wish to use vagrant to get a pre-configured, running IDE.
- Install VirtualBox and vagrant first.
- Create a new directory for vagrant and
cd
into it - Run
vagrant init rub-a-dub-dub/openhabdev32
- Execute
vagrant up
(this will take some time as a ~3GB virtual image needs to be downloaded) - Execute
vagrant ssh
to access your machine
To turn off the vagrant machine, run vagrant halt
in the vagrant directory you created. Run vagrant suspend
to just suspend the machine. To get rid of the VM and its resources, run vagrant destroy
. For more information on the setup and use of the IDE with vagrant, look here.
###Linux / OS X
###Windows
- Cosm Persistence
- db4o Persistence
- Exec Persistence
- InfluxDB Persistence
- JDBC Persistence
- JPA Persistence
- Logging Persistence
- mapdb Persistence
- MongoDB Persistence
- MQTT Persistence
- my.openHAB Persistence
- MySQL Persistence
- rrd4j Persistence
- Sen.Se Persistence
- SiteWhere Persistence
- AlarmDecoder Binding
- Anel Binding
- Arduino SmartHome Souliss Binding
- Asterisk Binding
- Astro Binding
- Autelis Pool Control Binding
- BenQ Projector Binding
- Bluetooth Binding
- Bticino Binding
- CalDAV Binding
- Comfo Air Binding
- Config Admin Binding
- CUL Binding
- CUL Intertechno Binding
- CUPS Binding
- DAIKIN Binding
- Davis Binding
- Denon Binding
- digitalSTROM Binding
- DMX512 Binding
- DSC Alarm Binding
- DSMR Binding
- eBUS Binding
- Ecobee Binding
- EDS OWSever Binding
- eKey Binding
- Energenie Binding
- EnOcean Binding
- Enphase Energy Binding
- Epson Projector Binding
- Exec Binding
- Freebox Binding
- Freeswitch Binding
- Frontier Silicon Radio Binding
- Fritz AHA Binding
- Fritz!Box Binding
- FS20 Binding
- Global Cache IR Binding
- GPIO Binding
- HAI/Leviton OmniLink Binding
- HDAnywhere Binding
- Heatmiser Binding
- Homematic / Homegear Binding
- HTTP Binding
- IEC 62056-21 Binding
- IHC / ELKO Binding
- ImperiHome Binding
- Insteon Hub Binding
- Insteon PLM Binding
- IPX800 Binding
- IRtrans Binding
- jointSPACE-Binding
- KNX Binding
- Koubachi Binding
- LCN Binding
- LightwaveRF Binding
- Leviton/HAI Omnilink Binding
- Lg TV Binding
- Logitech Harmony Hub
- MailControl Binding
- MAX!Cube-Binding
- MAX! CUL Binding
- MiLight Binding
- MiOS Binding
- Modbus TCP Binding
- MPD Binding
- MQTT Binding
- MQTTitude binding
- Neohub Binding
- Nest Binding
- Netatmo Binding
- Network Health Binding
- Network UPS Tools Binding
- Nibe Heatpump Binding
- Nikobus Binding
- Novelan/Luxtronic Heatpump Binding
- NTP Binding
- One-Wire Binding
- Onkyo AV Receiver Binding
- Open Energy Monitor Binding
- OpenPaths presence detection binding
- OpenSprinkler Binding
- OSGi Configuration Admin Binding
- Panasonic TV Bindung
- panStamp Binding
- Philips Hue Binding
- Piface Binding
- pilight Binding
- Pioneer-AVR-Binding
- Plex Binding
- Plugwise Binding
- PLCBus Binding
- Primare Binding
- Pulseaudio Binding
- RFXCOM Binding
- RWE Smarthome Binding
- Sager WeatherCaster Binding
- Samsung AC Binding
- Samsung TV Binding
- Serial Binding
- Sallegra Binding
- Satel Alarm Binding
- Sinthesi Sapp Binding
- Snmp Binding
- Somfy URTSI II Binding
- Sonos Binding
- Squeezebox Binding
- Swegon ventilation Binding
- System Info Binding
- TA CMI Binding
- TCP/UDP Binding
- Tellstick Binding
- TinkerForge Binding
- Tivo Binding
- VDR Binding
- Velleman-K8055-Binding
- Wago Binding
- Wake-on-LAN Binding
- Waterkotte EcoTouch Heatpump Binding
- Weather Binding
- Wemo Binding
- Withings Binding
- XBMC Binding
- xPL Binding
- Yamahareceiver Binding
- Zibase Binding
- Z-Wave Binding
- Asterisk
- Google Calendar
- Linux Media Players
- ROS Robot Operating System
- Telldus Tellstick
- Zoneminder
- Wink Hub (rooted)
- Wink Monitoring
- Transformations
- XSLT
- JSON
- REST-API
- Security
- Service Discovery
- Voice Control
- BritishGasHive-Using-Ruby
- Dropbox Bundle
A good source of inspiration and tips from users gathered over the years. Be aware that things may have changed since they were written and some examples might not work correctly.
Please update the wiki if you do come across any out of date information.
- Comfo Air Binding
- Ecobee Examples
- Nest Examples
- Rollershutter Bindings
- Squeezebox
- WAC Binding
- WebSolarLog
- Alarm Clock
- Convert Farenheit to Celcius
- The mother of all lighting rules
- Reusable Rules via Functions
- Combining different Items
- Items, Rules and more Examples of a SmartHome
- Google Map
- Controlling openHAB with Android
- Usecase examples
- B-Control Manager
- Spell checking for foreign languages
- Flic via Tasker
- Chromecast via castnow