openhab-examples
This is an old revision of the document!
Table of Contents
Exapmles 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
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 in e2p to the third port):
Switch Water_Basement "Water sensor basement [MAP(water.map):%s]" (gBasement,gSensorWater,gSensor) {smarthomatic="<[deviceId=123, messageGroupId=1, messageId=1, messagePart=2]"}
The water.map file:
ON=dry OFF=wet -=??
The rule to send a mail if a short between the pins is connected:
val String mailTo = mymail@server.com rule "water detection" when Item gSensorWater received update then // 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!") Alarm_Water.postUpdate(ON) } end rule "water alarm" when Item Alarm_Water received update ON then report = gSensorWater.allMembers.map[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 ) end
openhab-examples.1435513609.txt.gz · Last modified: 2015/06/28 19:46 by GoHoHa