Skip to content

Samples Binding Config

teichsta edited this page Nov 20, 2013 · 8 revisions

Samples for binding configurations

This page contains samples for binding configurations. These samples are sorted by binding.

<wiki:toc max_depth="2" />

How to send Date and Time from NTP to KNX

This example sends the current date and time from the NTP to the KNX binding

DateTime Date "Date & Time [%1$td.%1$tm.%1$tY %1$tT]" { ntp="Europe/Berlin:de_DE", knx="11.001:0/7/1, 10.001:0/7/2" } 

Items: 0/0/1 is the GA for Date 0/0/2 is the GA for Time

Additional information on date and time formatting can be found here

How to get temperatures from OW-SERVER via HTTP binding

Requirements:

Instructions:

  1. Go to http://<ow-server-IP>/devices.htm and look for the ROMId-Value https://lh3.googleusercontent.com/-XdaTtDlzyEU/Ud7_uB4fPCI/AAAAAAAALTY/pmajPpkk6uo/s300/owserver_devices.PNG
  2. Add an Number-Item to your items-configuration like this one

{{{ // Example: Number Temp_Kitch "Küche °C" { http="<[Units="Centigrade">(.?).)](http://192.168.1.16/details.xml:60000:REGEX(.?A7000002CC4D2228.?<Temperature)" } }}}

Replace the ip address and the ROMId-value with your data.

How to get humidity from OW-SERVER via HTTP binding

Device: OW-ENV-TH (EDS0065)

// Example: Number Humidity "Humidity [%.1f %%]" { http="<[http://192.168.1.16/details.xml:5000:REGEX(.?C30010000027767E.?<Humidity Units="PercentRelativeHumidity">(.?).)]" }

How to get contact from OW-SERVER via HTTP binding

Device: D2C (DS2406)

// Example: Number Door "Door [MAP(contact.map):%d]" { http="<[http://192.168.1.16/details.xml:5000:REGEX(.?BD0000009D93DC12.?<InputLevel_A>(.?)</InputLevel_A>.)]" } You may want to change the query-interval (here 5000ms) to a few seconds. You can get the value for InputLevel_B, too. ;)

contact.map: 0=open 1=close -=UNKNOWN

How to turn on/off a switch from OW-SERVER via HTTP binding

Device: D2C (DS2406)

// Example: Switch Lamp "Switch [MAP(switch.map):%d]" { http="<[http://192.168.1.16/details.xml:5000:REGEX(.?BD0000009D93DC12.?<InputLevel_B>(.?)</InputLevel_B>.)]" } This only reads the state of the switch.

switch.map: 1=ON 0=OFF -=undefiniert

To turn the switch on or off you need to define two rules: rule "Turn Lamp on" when Item Lamp changed to ON then sendHttpGetRequest("http://192.168.1.16/devices.htm?rom=BD0000009D93DC12&variable=FlipFlop_B&value=0") end

rule "Turn Lamp off"
when 
	Item Lamp changed to OFF
then
	sendHttpGetRequest("http://192.168.1.16/devices.htm?rom=BD0000009D93DC12&variable=FlipFlop_B&value=1")
end

How to read the status from a OneWire sensor DS2413 (2 port I/O)

item definition: Number WindowContact1 "Window 1 is [MAP(contact.map):%s]" (All) { onewire = "3C.16AA13000000#sensed.A" } Number WindowContact2 "Window 2 is [MAP(contact.map):%s]" (All) { onewire = "3C.16AA13000000#sensed.B" }

sitemap definition: Text item=WindowContact1 Text item=WindowContact2

map file contact.map 1=closed 0=opened

Sample output for this definition would then be "Window 1 is opened" or "Window 2 is closed".

How to get data from Kostal Piko solar inverter via HTTP binding

https://lh4.googleusercontent.com/-pa3EqaUPe_E/Ud8lK56J_-I/AAAAAAAALT0/KNOfi7gWe_c/s300/openhab_kostal_piko_screenshot.PNG

/* AC-Leistung */
Number Solar_Aktuell "aktuell [%.0f W]" { http="<[http://pvserver:[email protected]/index.fhtml:60000:REGEX(.*?aktuell</td>.*? (.*?)</td>.*)]" }

/* Energie */
Number Solar_Gesamt "Gesamtenergie [%.0f kWh]" { http="<[http://pvserver:[email protected]/index.fhtml:60000:REGEX(.*?Gesamtenergie</td>.*? (.*?)</td>.*)]" }
Number Solar_Tagesenergie "Tagesenergie [%.2f kWh]" { http="<[http://pvserver:[email protected]/index.fhtml:60000:REGEX(.*?Tagesenergie</td>.*? (.*?)</td>.*)]" }

/* PV-Generator */
Number Solar_PVG_Str1_Spannung "String 1 Spannung [%.0f V]" { http="<[http://pvserver:[email protected]/index.fhtml:60000:REGEX(.*?String 1</u></td>.*?Spannung</td>.*? (.*?)</td>.*)]" }
Number Solar_PVG_Str1_Strom "String 1 Strom [%.2f A]" { http="<[http://pvserver:[email protected]/index.fhtml:60000:REGEX(.*?String 1</u></td>.*?Strom</td>.*? (.*?)</td>.*)]" }

Number Solar_PVG_Str2_Spannung "String 2 Spannung [%.0f V]" { http="<[http://pvserver:[email protected]/index.fhtml:60000:REGEX(.*?String 2</u></td>.*?Spannung</td>.*? (.*?)</td>.*)]" }
Number Solar_PVG_Str2_Strom "String 2 Strom [%.2f A]" { http="<[http://pvserver:[email protected]/index.fhtml:60000:REGEX(.*?String 2</u></td>.*?Strom</td>.*? (.*?)</td>.*)]" }


/* Ausgangsleistung */
Number Solar_AL_L1_Spannung "L1 Spannung[%.0f V]"  { http="<[http://pvserver:[email protected]/index.fhtml:60000:REGEX(.*?L1</u></td>.*?Spannung.*?Spannung</td>.*? (.*?)</td>.*)]" }
Number Solar_AL_L1_Leistung "L1 Leistug [%.0f W]"  { http="<[http://pvserver:[email protected]/index.fhtml:60000:REGEX(.*?L1</u></td>.*?Leistung</td>.*? (.*?)</td>.*)]" }

Number Solar_AL_L2_Spannung "L2 Spannung [%.0f V]" { http="<[http://pvserver:[email protected]/index.fhtml:60000:REGEX(.*?L2</u></td>.*?Spannung.*?Spannung</td>.*? (.*?)</td>.*)]" }
Number Solar_AL_L2_Leistung "L2 Leistug [%.0f W]"  { http="<[http://pvserver:[email protected]/index.fhtml:60000:REGEX(.*?L2</u></td>.*?Leistung</td>.*? (.*?)</td>.*)]" }

Number Solar_AL_L3_Spannung "L3 Spannung [%.0f V]" { http="<[http://pvserver:[email protected]/index.fhtml:60000:REGEX(.*?L3</u></td>.*?Spannung</td>.*? (.*?)</td>.*)]" }
Number Solar_AL_L3_Leistung "L3 Leistug [%.0f W]"  { http="<[http://pvserver:[email protected]/index.fhtml:60000:REGEX(.*?L3</u></td>.*?Leistung</td>.*? (.*?)</td>.*)]" }

Make sure you replace "password" with your password and edit the ip address.

How to send commands to Telldus Tellstick

This a simple example of how to command your tellstick devices from Openhab. For event triggered inbound integration, check the Integration with other applications page.

Please note that if you use the inbound integration you must name you item td_device_<number> where <number> is the tellstick device enumeration as listed from command: tdtool -l. Obviously you also need to change enumeration after --on and --off in the exec binding.

Item definition: Switch td_device_5 "Tellstick device 5" {exec=">[ON:tdtool --on 5] >[OFF:tdtool --off 5]"}

How to get power on a TV connected to HDMI with exec binding and update the status automatically

This is an example of how to power on a TV connected to the openhab server via HDMI. First you have to install cec-client utility on your host (you can see more details in [page)

The next thing is use the exec and the samsung binding (I can't switch on the TV with the samsung binding, and I can't switch off with the cec-client). My item definition shows like:

524546160a290670bf49dbd8049627ae

And the script /usr/local/bin/samsungTvStart.sh is aeca1ce6aa669e26d80d13ce7735bf08

The next thing is automatically check and update the status. I use a shell script that I run every minute with cron. The script /usr/local/bin/samsungTvCheck.sh is

175bbdfbe02077d98c182b2db3fdbe00

and you can add a line to your cron (in linux systems) with the command

acbe2674511923eb8be60227383a1b20

Note that you have to change OPENHAB_URL, [OPENHAB_PASS and [OPENHAB_ITEM] according to your installation. This script update the status of the item, and you can see if your childs has switch on the tv ;)

Installation

Community

Features

Samples

Release Notes

Clone this wiki locally