Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Samples Item Definitions

Shiny edited this page Aug 22, 2016 · 29 revisions

Samples of Item definitions

How to configure a switch to be a pushbutton

German Thread

Item:

Switch Garage_Gate { binding="xxx", autoupdate="false"}

Sitemap:

Switch item=Garage_Gate label="Garage" mappings=[ON="Go!"]

The magic happens with autoupdate="false" which keeps the current state, even if an ON command has been received. This way, it's always off unless you explicitly post an update to this item.

How to set up voice control for use with HABDroid

The following example shows an item called test_item being turned on by issuing the voice command in HABDroid

Item:

String VoiceCommand

Rule:

rule "test example rule name"
when
                Item VoiceCommand received command test
        then
                test_item.sendCommand(ON)
end

How to get special characters like "%" in a label text

Number Humidity "Humidity [%.1f %%]"

How to use HTTP binding to remotely control devices with a web interface

LG Hombot robot cleaner:

String Hombot "Luigi, Hombot [status %s]" <luigi> (Status) { http=">[1:GET:http://192.168.1.2:6260/json.cgi?%%7b%%22COMMAND%%22:%%22CLEAN_START%%22%%7d] >[0:GET:http://192.168.1.2:6260/json.cgi?%%7b%%22COMMAND%%22:%%22PAUSE%%22%%7d] >[2:GET:http://192.168.1.2:6260/json.cgi?%%7b%%22COMMAND%%22:%%22HOMING%%22%%7d] <[http://192.168.1.2:6260/status.html:5000:REGEX(.*<b>Robot-state</b>: <status>(.+)</status>.*)]", autoupdate="false" }

in sitemap:

Switch item=Hombot label="Luigi, Hombot [status %s]" mappings=[1="Clean", 2="Charge", 0="Pause"]

Dreambox satellite receiver:

Switch Dreambox "Dreambox [%s]" <video> (EG_Wohnen,Status) { http=">[ON:POST:http://dm500hd/web/powerstate?newstate=4] >[OFF:POST:http://dm500hd/web/powerstate?newstate=5]" }

Installation


User Interfaces


Community

(link to openHAB forum)

Development



Misc


Samples

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.

Use case examples

Collections of Rules on a single page

Single Rules

Scripts


Release Notes

Clone this wiki locally