Http Binding ausesen in Switch


i have a webserver site with a status of a external senor. The Status have following String
“Aussenbereich: EIN” or “Aussenbereich: AUS”

I try to get the Signal in a Switch Item bu it doesnt work :frowning:
also to read as a STRing

{http="<[ EIN([0-9].[0-9]*)]"

can somebody help me


{http="&lt;[*?Aussenbereich: (.*?))]" should get you a String item if that line REALLY is the whole web page contents


i’ve got nothing only “-”

String testaussen "test aussen [%s]" (gHttp) {http="&lt;[*?Aussenbereich: (.*?))]"}


What do you really get with the simple format?

String testaussen "test aussen [%s]" (gHttp) {http="<[*?))]"}
1 Like
I've got: "<html><head><title>Aussen</title><meta http-equiv="Refresh"conten="99"><script language="JavaScript"> ..........<p>Status Aussenbereich:EIN</p>......."

So, the REGEX would be

String testaussen "test aussen [%s]" (gHttp) {http="<[*senbereich.(.*?)</p>.*)]"}
String Status_AB    "Status Aussenbereich SPS [%s]" (gHttp)         {http="<[*?<p>Status Aussenbereich:(.*?)</p>.*)]" }

Now i become “EIN” or “AUS”

The value i use in a rule to transfer as a Switch/Contact.

Is there a direct way without the detour of the “String-Item”? In the Web server, I can store any other output value so also “1” or “0” or ON / OFF?

As the response is EIN or AUS, but openHAB uses ON and OFF, there is no direct way. Of course you can use a JavaScript Transformation. Something like

String testaussen "test aussen [%s]" (gHttp) {http="<[]"}


(function(dataString) {
    val sAnswer = dataString.replace(/.*?<p>Status Aussenbereich:(.*?)<\/p>.*/g,'$1');
    reply = if(sAnswer == "EIN") "ON" else "OFF";
    return reply;

If this is working as expected, you can change the String Item to a Switch Item.

Hello Udo,

unfortunately, the conversion does not work.
I change also “<\/p>” to -->


p>" but no effect :frowning:

(function(dataString) {
    val sAnswer = dataString.replace(/.*?<p>Status Aussenbereich:(.*?)</p>.*/g,'$1');
    reply = if(sAnswer == "EIN") "ON" else "OFF";
    return reply;

I get the following error message in log:

2018-09-10 12:21:33.904 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type JS:
2018-09-10 12:21:33.906 [WARN ] [ab.binding.http.internal.HttpBinding] - Couldn’t transform response because transformationService of type ‘JS:’ is unavailable

Yes, you have to install JavaScript Transformation Service (as stated by the WARN Message)

Be aware that the slash must be escaped by \ or \\ , so it’s either




Only one of this options is correct :slight_smile:

Hi Udo,

i do something wrong. In the Paper UI i already have installed by Transformations the Javascript Transformation
transformation-javascript - 2.2.0.
I uninstall this and afterwards I install it again. I’ve got the same warning “[WARN ] [ab.binding.http.internal.HttpBinding] - Couldn’t transform response because transformationService of type ‘JS:’ is unavailable”

I stopped Openhab and update and upgrade the raspi.

All transformations in the paper UI are installed.

hmm, that’s strange.

Maybe stop openHAB, delete the cache and restart openHAB.

Please consider to update to openHAB2.3 stable. Of course JavaScript should work anyway…


I now i have a new Version 2.3. I lost the KNX Connection. I do the same like in the KNX.cfg (IP;TUNNEL;Port)
in the Things.
More information is still required??
I use a ABB IPR/S 3.1.1 (With the old binding (binding-knx1 - 1.11.0) it was working)

for the Java ive got the same result
2018-09-16 09:53:13.369 [WARN ] [ab.binding.http.internal.HttpBinding] - Couldn’t transform response because transformationService of type ‘JS:’ is unavailable

Please be aware that the knx Binding was upgraded to knx2, you have to configure a Bridge, Things and Channels (and bind these channels to the Items).

Another option is, to change a setting in Paper UI:
Configuration->System->Add-on Management->Include Legacy 1.x Bindings (switch ON)
Uninstall knx2 Add-ons->Bindings->knx->UNINSTALL
Install knx1 Add-ons->Bindings->knx1->INSTALL

From this point, use knx1 as before.

Im use the old Version 1.x binding and ist working, only where i enter the Name of Default sitemap. I have no demo.sitemap and by the clasic UI I have not the correct site.

I found it by Services. But the JS transform will also not aviable by the verision 2.3 :frowning:
I uninstal JS transform and install again without a effect.

That’s really strange!