Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

JPA Persistence

mdbergmann edited this page Nov 24, 2014 · 7 revisions

Documentation of the JPA Persistence Service

Introduction

This service allows you to persist state updates using a SQL or NoSQL database. The Binding uses an abstraction layer that theoretically allows it to support many available SQL or NoSQL databases.

Features

This persistence service supports writing information to SQL or NoSQL database systems. Currently, with openHAB 1.6, the binding supports MySQL, Apache Derby and PostgreSQL databases.

Installation

For installation of this persistence package please follow the same steps as if you would install a binding.

Additionally, place a persistence file called jpa.persist in the ${openhab.home}/configuration/persistence folder. This has the standard format as described in Persistence.

Configuration

This persistence service can be configured in the "JPA Persistence Service" section in openhab.cfg. Available are four configuration settings.

Connection URL

jpa:url   # this is jdbc connection url to the database

Examples:

jpa:url=jdbc:postgresql://hab.local:5432/openhab
jpa:url=jdbc:derby://hab.local:1527/openhab;create=true
jpa:url=jdbc:mysql://localhost:3306/openhab

Attention: databases "openhab" for MySQL and PostgreSQL must be created manually first. The JPA binding does not create databases, except this is possible as configuration in the jdbc url (see Apache Derby example).

Database driver

jpa:driver        # the database driver class name

Examples:

jpa:driver=org.postgresql.Driver
jpa:driver=org.apache.derby.jdbc.ClientDriver
jpa:driver=com.mysql.jdbc.Driver

Username

jpa:user=         # the database username for connection

Password

jpa:password=     # the database username password for connection

Database overview

The binding will create one table "historic_item" where all item states are stored. The item state as such is stored as a string representation.

Installation


User Interfaces


Community

(link to openHAB forum)

Development



Misc


Samples

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.

Use case examples

Collections of Rules on a single page

Single Rules

Scripts


Release Notes

Clone this wiki locally