User Tools

Site Tools


openhab-examples

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
openhab-examples [2015/06/28 19:45] – created GoHoHaopenhab-examples [2015/06/28 19:56] – [A flood detection sensor] GoHoHa
Line 7: Line 7:
 ====== Item definitions ====== ====== Item definitions ======
  
 +An EnvSensor with Temperature + Humidity message:
 +<code>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)]"}</code>
 +
 +A battery status message:
 +<code>Number Batt1 "Battery1 [%.0f]" (gBattery) {smarthomatic="<[deviceId=123, messageGroupId=0, messageId=5]"}</code>
 +
 +Two switches connected to a GPIO pins and mapped to DigitalInputPin 0 and 1 in e2p  :
 +<code>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]"}</code>
  
  
Line 13: Line 23:
 Based on the EnvSensor the short between a GPIO-PIN and GND or a special switch can be used as a water 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): +The item definition on OpenHAB (the contacts are mapped to the third DigitalInputPin in e2p): 
-''Switch Water_Basement "Water sensor basement [MAP(water.map):%s]" (gBasement,gSensorWater,gSensor) {smarthomatic="<[deviceId=123, messageGroupId=1, messageId=1, messagePart=2]"}''+ 
 +<code>Switch Water_Basement "Water sensor basement [MAP(water.map):%s]" (gBasement,gSensorWater,gSensor) {smarthomatic="<[deviceId=123, messageGroupId=1, messageId=1, messagePart=2]"}</code>
  
 The water.map file: The water.map file:
-''ON=dry+<code>ON=dry
 OFF=wet OFF=wet
--=??''+-=??</code>
  
 The rule to send a mail if a short between the pins is connected: The rule to send a mail if a short between the pins is connected:
-''val String mailTo = mymail@server.com+<code>val String mailTo = mymail@server.com
  
 rule "water detection" rule "water detection"
Line 44: Line 55:
    sendMail(mailTo, "WATER ALARM!!", message )    sendMail(mailTo, "WATER ALARM!!", message )
  
-  end'' +  end</code>
openhab-examples.txt · Last modified: 2015/06/29 00:17 by breaker27