-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Samples Binding Config
This page contains samples for binding configurations. These samples are sorted by binding.
- How to send Date and Time from NTP to KNX
- How to get temperatures from OW-SERVER via HTTP binding
- How to get humidity from OW-SERVER via HTTP binding
- How to get contact from OW-SERVER via HTTP binding
- How to turn on/off a switch from OW-SERVER via HTTP binding
- How to read the status from a OneWire sensor DS2413 (2 port I/O)
- How to get data from Kostal Piko solar inverter via HTTP binding
- How to send commands to Telldus Tellstick
- How to get power on a TV connected to HDMI with exec binding and update the status automatically
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
Requirements:
- OW-SERVER with Ethernet
- DS18B20-Sensors (or DS18S20) connected via 1-wire-bus
Instructions:
-
Go to http://
<ow-server-IP>
/devices.htm and look for the ROMId-Value -
Add an Number-Item to your items-configuration like this one
// Example:
Number Temp_Kitch "Küche [°C](%.1f)" { http="<[Units=\"Centigrade\">(.*?)</Temperature>.*)](http://192.168.1.16/details.xml:60000:REGEX(.*?<ROMId>A7000002CC4D2228</ROMId>.*?<Temperature)" }
Replace the ip address and the ROMId-value with your data.
Device: OW-ENV-TH (EDS0065)
Example:
Number Humidity "Humidity [%.1f %%]" { http="<[http://192.168.1.16/details.xml:5000:REGEX(.*?<ROMId>C30010000027767E</ROMId>.*?<Humidity Units=\"PercentRelativeHumidity\">(.*?)</Humidity>.*)]" }
Device: D2C (DS2406)
Example:
Number Door "Door [MAP(contact.map):%d]" { http="<[http://192.168.1.16/details.xml:5000:REGEX(.*?<ROMId>BD0000009D93DC12</ROMId>.*?<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
Device: D2C (DS2406)
Example:
Switch Lamp "Switch [MAP(switch.map):%d]" { http="<[http://192.168.1.16/details.xml:5000:REGEX(.*?<ROMId>BD0000009D93DC12</ROMId>.*?<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
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".
/* AC-Leistung */
Number Solar_Aktuell "aktuell [%.0f W]" { http="<[http://pvserver:password@192.168.0.27/index.fhtml:60000:REGEX(.*?aktuell</td>.*? (.*?)</td>.*)]" }
/* Energie */
Number Solar_Gesamt "Gesamtenergie [%.0f kWh]" { http="<[http://pvserver:password@192.168.0.27/index.fhtml:60000:REGEX(.*?Gesamtenergie</td>.*? (.*?)</td>.*)]" }
Number Solar_Tagesenergie "Tagesenergie [%.2f kWh]" { http="<[http://pvserver:password@192.168.0.27/index.fhtml:60000:REGEX(.*?Tagesenergie</td>.*? (.*?)</td>.*)]" }
/* PV-Generator */
Number Solar_PVG_Str1_Spannung "String 1 Spannung [%.0f V]" { http="<[http://pvserver:password@192.168.0.27/index.fhtml:60000:REGEX(.*?String 1</u></td>.*?Spannung</td>.*? (.*?)</td>.*)]" }
Number Solar_PVG_Str1_Strom "String 1 Strom [%.2f A]" { http="<[http://pvserver:password@192.168.0.27/index.fhtml:60000:REGEX(.*?String 1</u></td>.*?Strom</td>.*? (.*?)</td>.*)]" }
Number Solar_PVG_Str2_Spannung "String 2 Spannung [%.0f V]" { http="<[http://pvserver:password@192.168.0.27/index.fhtml:60000:REGEX(.*?String 2</u></td>.*?Spannung</td>.*? (.*?)</td>.*)]" }
Number Solar_PVG_Str2_Strom "String 2 Strom [%.2f A]" { http="<[http://pvserver:password@192.168.0.27/index.fhtml:60000:REGEX(.*?String 2</u></td>.*?Strom</td>.*? (.*?)</td>.*)]" }
/* Ausgangsleistung */
Number Solar_AL_L1_Spannung "L1 Spannung[%.0f V]" { http="<[http://pvserver:password@192.168.0.27/index.fhtml:60000:REGEX(.*?L1</u></td>.*?Spannung.*?Spannung</td>.*? (.*?)</td>.*)]" }
Number Solar_AL_L1_Leistung "L1 Leistug [%.0f W]" { http="<[http://pvserver:password@192.168.0.27/index.fhtml:60000:REGEX(.*?L1</u></td>.*?Leistung</td>.*? (.*?)</td>.*)]" }
Number Solar_AL_L2_Spannung "L2 Spannung [%.0f V]" { http="<[http://pvserver:password@192.168.0.27/index.fhtml:60000:REGEX(.*?L2</u></td>.*?Spannung.*?Spannung</td>.*? (.*?)</td>.*)]" }
Number Solar_AL_L2_Leistung "L2 Leistug [%.0f W]" { http="<[http://pvserver:password@192.168.0.27/index.fhtml:60000:REGEX(.*?L2</u></td>.*?Leistung</td>.*? (.*?)</td>.*)]" }
Number Solar_AL_L3_Spannung "L3 Spannung [%.0f V]" { http="<[http://pvserver:password@192.168.0.27/index.fhtml:60000:REGEX(.*?L3</u></td>.*?Spannung</td>.*? (.*?)</td>.*)]" }
Number Solar_AL_L3_Leistung "L3 Leistug [%.0f W]" { http="<[http://pvserver:password@192.168.0.27/index.fhtml:60000:REGEX(.*?L3</u></td>.*?Leistung</td>.*? (.*?)</td>.*)]" }
Make sure you replace "password" with your password and edit the ip address.
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]"}
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:
Switch TV_GF_Living_TV_power "Power" (GF_Living_TV) { exec="ON:/usr/local/bin/samsungTvStart.sh, OFF:/bin/true", samsungtv="OFF:Livingroom:KEY_POWEROFF, ON:Livingroom:KEY_POWERON" }
And the script /usr/local/bin/samsungTvStart.sh is
echo 'on 0' | cec-client -s
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
#!/bin/bash
OH_URL=[OPENHAB_URL]
OH_USER=[OPENHAB_USER]
OH_PASS=[OPENHAB_PASS]
OH_ITEM=[OPENHAB_ITEM]
RESULT=`echo pow 0 | cec-client -d 1 -s | grep "power status:" | awk '{ print $3; }'`
case $RESULT in
on)
curl --user $OH_USER:$OH_PASS --max-time 2 --connect-timeout 2 --header "Content-Type: text/plain" --request PUT --data "ON" $OH_URL/rest/items/$OH_ITEM/state
exit 0
;;
*)
curl --user $OH_USER:$OH_PASS --max-time 2 --connect-timeout 2 --header "Content-Type: text/plain" --request PUT --data "OFF" $OH_URL/rest/items/$OH_ITEM/state
exit 1
esac
and you can add a line to your cron (in linux systems) with the command
crontab -e
*/1 * * * * /usr/local/bin/samsungTvCheck.sh
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 ;)
ℹ Please find all documentation for openHAB 2 under http://docs.openhab.org.
The wiki pages here contain (outdated) documentation for the older openHAB 1.x version. Please be aware that a lot of core details changed with openHAB 2.0 and this wiki as well as all tutorials found for openHAB 1.x might be misleading. Check http://docs.openhab.org for more details and consult the community forum for all remaining questions.
- Classic UI
- iOS Client
- Android Client
- Windows Phone Client
- GreenT UI
- CometVisu
- Kodi
- Chrome Extension
- Alfred Workflow
- Cosm Persistence
- db4o Persistence
- Amazon DynamoDB Persistence
- Exec Persistence
- Google Calendar Presence Simulator
- InfluxDB Persistence
- JDBC Persistence
- JPA Persistence
- Logging Persistence
- mapdb Persistence
- MongoDB Persistence
- MQTT Persistence
- my.openHAB Persistence
- MySQL Persistence
- rrd4j Persistence
- Sen.Se Persistence
- SiteWhere Persistence
- AKM868 Binding
- AlarmDecoder Binding
- Anel Binding
- Arduino SmartHome Souliss Binding
- Asterisk Binding
- Astro Binding
- Autelis Pool Control Binding
- BenQ Projector Binding
- Bluetooth Binding
- Bticino Binding
- CalDAV Binding
- Chamberlain MyQ Binding
- Comfo Air Binding
- Config Admin Binding
- CUL Transport
- CUL Intertechno Binding
- CUPS Binding
- DAIKIN Binding
- Davis Binding
- DD-WRT Binding
- Denon Binding
- digitalSTROM Binding
- DIY on XBee Binding
- DMX512 Binding
- DSC Alarm Binding
- DSMR Binding
- eBUS Binding
- Ecobee Binding
- EDS OWSever Binding
- eKey Binding
- Energenie Binding
- EnOcean Binding
- Enphase Energy Binding
- Epson Projector Binding
- Exec Binding
- Expire Binding
- Fatek PLC Binding
- Freebox Binding
- Freeswitch Binding
- Frontier Silicon Radio Binding
- Fritz AHA Binding
- Fritz!Box Binding
- FritzBox-TR064-Binding
- FS20 Binding
- Garadget Binding
- Global Caché IR Binding
- GPIO Binding
- HAI/Leviton OmniLink Binding
- HDAnywhere Binding
- Heatmiser Binding
- Homematic / Homegear Binding
- Horizon Mediabox Binding
- HTTP Binding
- IEC 62056-21 Binding
- IHC / ELKO Binding
- ImperiHome Binding
- Insteon Hub Binding
- Insteon PLM Binding
- IPX800 Binding
- IRtrans Binding
- jointSPACE-Binding
- KM200 Binding
- KNX Binding
- Koubachi Binding
- LCN Binding
- LightwaveRF Binding
- Leviton/HAI Omnilink Binding
- Lg TV Binding
- Logitech Harmony Hub
- MailControl Binding
- MAX!Cube-Binding
- MAX! CUL Binding
- MCP23017 I/O Expander Binding
- MCP3424 ADC Binding
- MiLight Binding
- MiOS Binding
- Mochad X10 Binding
- Modbus Binding
- MPD Binding
- MQTT Binding
- MQTTitude binding
- MystromEcoPower Binding
- Neohub Binding
- Nest Binding
- Netatmo Binding
- Network Health Binding
- Network UPS Tools Binding
- Nibe Heatpump Binding
- Nikobus Binding
- Novelan/Luxtronic Heatpump Binding
- NTP Binding
- One-Wire Binding
- Onkyo AV Receiver Binding
- Open Energy Monitor Binding
- OpenPaths presence detection binding
- OpenSprinkler Binding
- OSGi Configuration Admin Binding
- Panasonic TV Binding
- panStamp Binding
- Philips Hue Binding
- Picnet Binding
- Piface Binding
- PiXtend Binding
- pilight Binding
- Pioneer-AVR-Binding
- Plex Binding
- Plugwise Binding
- PLCBus Binding
- PowerDog Local API Binding
- Powermax alarm Binding
- Primare Binding
- Pulseaudio Binding
- Raspberry Pi RC Switch Binding
- RFXCOM Binding
- RWE Smarthome Binding
- Sager WeatherCaster Binding
- Samsung AC Binding
- Samsung TV Binding
- Serial Binding
- Sallegra Binding
- Satel Alarm Binding
- Siemens Logo! Binding
- SimpleBinary Binding
- Sinthesi Sapp Binding
- Smarthomatic Binding
- Snmp Binding
- Somfy URTSI II Binding
- Sonance Binding
- Sonos Binding
- Souliss Binding
- Squeezebox Binding
- Stiebel Eltron Heatpump
- Swegon ventilation Binding
- System Info Binding
- TA CMI Binding
- TCP/UDP Binding
- Tellstick Binding
- TinkerForge Binding
- Tivo Binding
- UCProjects.eu Relay Board Binding
- UPB Binding
- VDR Binding
- Velleman-K8055-Binding
- Wago Binding
- Wake-on-LAN Binding
- Waterkotte EcoTouch Heatpump Binding
- Weather Binding
- Wemo Binding
- Withings Binding
- XBMC Binding
- xPL Binding
- Yamahareceiver Binding
- Zibase Binding
- Z-Wave Binding
- Asterisk
- DoorBird
- FIND
- Foscam IP Cameras
- LG Hombot
- Worx Landroid
- Heatmiser PRT Thermostat
- Google Calendar
- Linux Media Players
- Osram Lightify
- Rainforest EAGLE Energy Access Gateway
- Roku Integration
- ROS Robot Operating System
- Slack
- Telldus Tellstick
- Zoneminder
- Wink Hub (rooted)
- Wink Monitoring
- openHAB Cloud Connector
- Google Calendar Scheduler
- Transformations
- XSLT
- JSON
- REST-API
- Security
- Service Discovery
- Voice Control
- BritishGasHive-Using-Ruby
- Dropbox Bundle
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.
- Rollershutter Bindings
- Squeezebox
- WAC Binding
- WebSolarLog
- Alarm Clock
- Convert Fahrenheit to Celsius
- The mother of all lighting rules
- Reusable Rules via Functions
- Combining different Items
- Items, Rules and more Examples of a SmartHome
- Google Map
- Controlling openHAB with Android
- Usecase examples
- B-Control Manager
- Spell checking for foreign languages
- Flic via Tasker
- Chromecast via castnow
- Speedtest.net integration