User Tools

Site Tools


Examples for OpenHAB

At this page we collect example configurations for the OpenHAB integration of smarthomatic devices. using the Smarthomatic-Binding published at Github. Some example configurations can be found there as well.

Item definitions

An EnvSensor with Temperature + Humidity message:

Number Temp1 "Temperature1 [%.1f °C]" <temperature> (gTemperature) {smarthomatic="<[deviceId=123, messageGroupId=10, messageId=2, messagePart=1:JS(getDiv100.js)]"}
Number Humi1 "Humidity1 [%.0f]" (gHumidity) {smarthomatic="<[deviceId=2, messageGroupId=10, messageId=2, messagePart=0:JS(getDiv10.js)]"}

A battery status message:

Number Batt1 "Battery1 [%.0f]" (gBattery) {smarthomatic="<[deviceId=123, messageGroupId=0, messageId=5]"}

Two switches connected to a GPIO pins and mapped to DigitalInputPin 0 and 1 in e2p :

Switch Switch1 "Switch1" (gSwitch) {smarthomatic="<[deviceId=123, messageGroupId=1, messageId=1, messagePart=0]"}
Switch Switch1 "Switch1" (gSwitch) {smarthomatic="<[deviceId=123, messageGroupId=1, messageId=1, messagePart=1]"}

A flood detection sensor

Based on the EnvSensor the short between a GPIO-PIN and GND or a special switch can be used as a water detection sensor.

The item definition on OpenHAB (the contacts are mapped to the third DigitalInputPin in e2p):

Switch Water_Basement "Water sensor basement [MAP(]"	(gBasement,gSensorWater,gSensor) {smarthomatic="<[deviceId=123, messageGroupId=1, messageId=1, messagePart=2]"}

The file:


The rule to send a mail if a short between the pins is connected:

val String mailTo =

rule "water detection"
    Item gSensorWater received update
    // check for any water detection sensors in the house that are activated (OFF state = closed = wet)
    if (! gSensorWater.allMembers.filter([state == OFF]).empty) {
      logInfo("sensor.rules", "Water alarm tripped by short detection sensor!")

rule "water alarm"
    Item Alarm_Water received update ON
    report =[name + ": " + state].join("\n") 
    val message = "A water sensor was activated!!! \n\nsensor status:\n" + report + "\n\n regards, OpenHab"

   sendMail(mailTo, "WATER ALARM!!", message )

openhab-examples.txt · Last modified: 2015/06/29 00:17 by breaker27