HTTP binding - openHAB 3 version

Thanks @J-N-K and @rlkoshak for your replies!

I manged to adapt my script sending the battery status of my Windows tablet from UDP to writing it directly into the REST API of openHAB. So I can get rid of the TCP & UDP binding :-).

Another step into the direction of openHAB 3.X.

By the way, as textual configuration seems to be really outdated now, is there a way of “preparing” Things and Items in the UI, storing them and transferring their config? That I actually do with all my textual configuration. Besides my live openHAB 2.5 system, I have 3.x running for test purposes, try out step by step everything to find out where adaptations are needed and note or prepare them respectively in the configuration files. That allows me on a day X to switch from 2.x to 3.x and have it fully running within a short period of time (hopefully).

As by the new bindings, like the HTTP and TR-064, textual configuartion is not really foreseen anymore, I worry that it takes me a long time until I have everything setup properly over the UI.

I believe there is now an option to import text items.

It‘s perfectly possible to use textual configuration with the HTTP binding. It‘s just not supported by me.


I cannot figure out how to configure the channel to set a number value.
I get the value from the state, means there must be something with the command transformation or Command URL extension.

In Postman, this works:

POST: http://{{ip}}/api/v1/dimmer/2/on/?value=30


Number		dingzDimmerValueWohnzimmer
			"Wohnzimmer [%d]"
			(gPersist) {channel="http:url:dingzWZ:dingzDimmerValueWohnzimmer"}


		Switch	item=dingzDimmerValueWohnzimmer mappings=[0="AUS", 12="MIN", 30="MID", 55="MAX"]
		Slider  item=dingzDimmerValueWohnzimmer label="Helligkeit" minValue=12 maxValue=55 step=1

EDIT1: I removed the spaces in the “Command transformation”, I also tried with “REGEX:(.*)”

EDIT2: I guess the transformation works, I’m using now “REGEX:(.*)”

2020-12-18 17:51:01.747 [DEBUG] [.internal.RegExTransformationService] - about to transform '30' by the function '(.*)'
2020-12-18 17:51:04.671 [DEBUG] [.internal.RegExTransformationService] - about to transform '12' by the function '(.*)'
2020-12-18 17:51:08.945 [DEBUG] [.internal.RegExTransformationService] - about to transform '55' by the function '(.*)'
2020-12-18 17:51:14.982 [DEBUG] [.internal.RegExTransformationService] - about to transform '22' by the function '(.*)'
2020-12-18 17:51:20.166 [DEBUG] [.internal.RegExTransformationService] - about to transform '28' by the function '(.*)'
2020-12-18 17:51:22.843 [DEBUG] [.internal.RegExTransformationService] - about to transform '40' by the function '(.*)'

Any hints regarding the command stuff ?

EDIT3: it works that way. I just forgot to switch the thing command method to POST

1 Like

Hi, i started migrating to openhab 3. i do have some http textual items and i was wondering how to transfer them to openhab3 and continue to use in homekit as well. Obviously this does not work any longer in OH3:

Switch Baumvorne2 "Baum Vorne" <light> (gLight, gWE, gGR, Group_WE_lights, all_lights)  
	{ http=">[ON:POST:] >[OFF:POST:]" }

Thanks for pointing me in the right direction.

same problem here. You would use the new OH3 http binding. Unfortunately there is no example in the manual.

From what I found out so far, you need a things file

Thing http:url:vitowifi "VitoWifi" [ baseURL="", refresh=10] {        
   Type number : Channel_Vito_Betriebsmodus  "Vito_Betriebsmodus"  [ stateExtension="read?DP=0xb000&Type=Mode", stateTransformation="REGEX((^[-+]?[0-9]+))", commandExtension="write?DP=0xb000&Type=Mode&Value=%2$s" ]
   Type number : Channel_Vito_ManuellerModus "Vito_ManuellerModus" [ stateExtension="read?DP=0xb020&Type=Mode", stateTransformation="REGEX((^[-+]?[0-9]+))", commandExtension="write?DP=0xb020&Type=Mode&Value=%2$s" ]

and then you can adapt your items:

Number Vito_Betriebsmodus "Vito_Betriebsmodus"   <switch> (gHeating) {channel="http:url:vitowifi:Channel_Vito_Betriebsmodus"}
Number Vito_ManuellerModus "Vito_ManuellerModus" <switch> (gHeating) {channel="http:url:vitowifi:Channel_Vito_ManuellerModus"}`

however, it is not working. I will now try rebooting and so on.

1 Like

Hi all,

I have a question about the possibilities of the http binding.

Have been following this binding for a while, but I have no idea how to do this with the http binding.

I am currently using nodered http to extract information from web pages and display them as values in oh via mqtt.

I have put my question and current solution in a separate post.



I just switched to openHAB3 and relized that I need to update my http binding which I used for my “Feinstaub” sensor.

I posted my solution 2 years ago here: [SOLVED] Air pollution data from - #18 by NCO

Now i get it running with the new binding. This thread helped me to make it and also the documentation. But examples are in my opinion the biggest help. Because I am a fan of the textural definition, here my working example for the popular “Feinstaubsensor” project (

The http request http://feinstaubsensor-14255834/data.json is answering with a JSON string. So I need some simple JSONPATH transformation and one java script transformation. Data is polled every 10 seconds.

The Thing definition:

Thing http:url:feinstaub "Feinstaub" [ baseURL="http://feinstaubsensor-14255834/data.json", refresh=10] {        
      Type number : SDS_PM10 [ stateTransformation="JSONPATH:$.sensordatavalues[0].value" ]
      Type number : SDS_PM25 [ stateTransformation="JSONPATH:$.sensordatavalues[1].value" ]
      Type number : Temperatur [ stateTransformation="JSONPATH:$.sensordatavalues[2].value" ]
      Type number : Pressure [ stateTransformation="JS:airpressure.js" ]
      Type number : Humidity [ stateTransformation="JSONPATH:$.sensordatavalues[4].value" ]

I have a BME2080 sensor connected. The Humidity must be diveded by 100 to show hPa. I am doing this with a java transformation file airpressure.js:

(function(x) {
    var json = JSON.parse(x);
    return json.sensordatavalues[3].value/100;

And the Items:

/* **************************
 * Feinstaub sensor data
 * ************************** */
Number N_FS_SDS_PM10 "Partikelgröße 10µm [%.2f µg/m³]" { channel="http:url:feinstaub:SDS_PM10" }
Number N_FS_SDS_PM25 "Partikelgröße 2.5µm [%.2f µg/m³]" { channel="http:url:feinstaub:SDS_PM25" }
Number N_FS_Temperatur "Temperatur [%.2f °C]" <temperature> { channel="http:url:feinstaub:Temperatur" }
Number N_FS_Pressure "Luftdruck [%.2f hPa]" <pressure> { channel="http:url:feinstaub:Pressure" }
Number N_FS_Humidity "Luftfeuchte [%.2f %%]" <water> { channel="http:url:feinstaub:Humidity" }

I hope its helpful example of the binding for others and I hope the solution also OK for the insiders…


I migrated to OH3 now and the HTTP binding is my biggest challenge atm :wink:
I was still on v1 before migrating

I just used a .cfg file that pulled the pages and then used the expressions / transformations directly in the item like:
Number LOCALWEATHER_tempin "Temperatur innen [%.1f °C]" <temperature> (gLOCALWEATHER_inside) { http="<[WeatherObserverCache:300000:REGEX(.*?inTemp.*?value=\"([0-9]*.[0-9]*)\".*)]" }

My questions would be:

  • I defined a thing now for the base URL that was in v1 binding defined in the .cfg file
    .> Is guess this should still be correct

  • Now is the Channel definition a MUST?

  • Or could I still just leave the channels blank in the thing definition and keep the old items like above.
    I defined a Base URL Thing with the same name “WeatherObserverCache” like I did in the v1 binding. So I thought maybe there is still a way to query that cache.
    http:url:WeatherObserverCache "WetterStationHTTPCache" [ baseURL="http://ipgoeshere/livedata.htm", refresh=10]

I did not manage to get this running so far.
So for 1 channel I tried to create the channel in the thing file (which works, the admin UI shows the thing and that channel)
But the channel seems not to work.
Should the REGEX expression still be the same?

Thing http:url:WeatherObserverCache "WetterStationHTTPCache" [ baseURL="http://ipgoeshere/livedata.htm", refresh=10]  {        
      Type number : LW_TempOut [ stateTransformation="REGEX::(.*?outTemp.*?value=\"([-0-9]*.[0-9]*)\".*)" ]


Thanks! :slight_smile:

I have this channel configuration and the following file but the controller only gets a request for …/controller/ and not for the full path on mute/unmute


Any idea what the ideal configuration should look like?

If you want to add the transformed value to the URL you need to add %2$s to the commandExtension.

did you get it to work?
I think I also struggle with a similar thing to get the syntax how to use REGEX statetransformation in a channel of a things files done.
The documentation says REGEX:: however neither way I get it run

just to share if somebody wants to put a former HTTP Regex Expression in the new OH3 Binding via text file…

this works as replacement for the above:
Type number : LOCALWEATHER_tempin [ stateTransformation="REGEX:.*?inTemp.*?value=\"([0-9]*.[0-9]*)\".*" ]

Obviously, sorry for asking :frowning:

Now for the Volume I have a number in
$.data[:0].rooms.1.Volume ( JSON Path Validator)
but if I input that into state transformation I get undef on the item.

Please show the full response that you would like to transform.

  "requestUrl": "/raumserver/data/getRendererState?id=Studio",
  "action": "getRendererState",
  "error": false,
  "msg": "",
  "data": [
      "Mute": 0,
      "InstanceID": 0,
      "CurrentTrackMetaData": "<?xml version=\"1.0\"?>\n<DIDL-Lite xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\" xmlns:raumfeld=\"urn:schemas-raumfeld-com:meta-data/raumfeld\" xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\" xmlns:dc=\"\" xmlns:dlna=\"urn:schemas-dlna-org:metadata-1-0/\" xmlns:pv=\"\"><item id=\"0/Spotify/Track\" parentID=\"0/Spotify\" restricted=\"0\"><upnp:class>object.item.audioItem.musicTrack</upnp:class><raumfeld:section>Spotify</raumfeld:section><dc:title>Blue Kind (feat. Enlery)</dc:title><upnp:artist>7 Skies</upnp:artist><upnp:album>Blue Kind (feat. Enlery)</upnp:album><upnp:albumArtURI dlna:profileID=\"JPEG_TN\"></upnp:albumArtURI><res duration=\"0:03:50.000\" protocolInfo=\"spotify:*:audio/spotify-track:*\">spotify:track:2KgbxrDjpYMFdaV02OwgTI</res></item></DIDL-Lite>\n",
      "CurrentRecordQualityMode": "NOT_IMPLEMENTED",
      "AbsoluteTimePosition": "00:02:42",
      "SecondsUntilSleep": "0",
      "CurrentTrack": "1",
      "AVTransportURIMetaData": "<?xml version=\"1.0\"?>\n<DIDL-Lite xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\" xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\" xmlns:dc=\"\" xmlns:dlna=\"urn:schemas-dlna-org:metadata-1-0/\" xmlns:pv=\"\"><item restricted=\"1\"/></DIDL-Lite>\n",
      "PossiblePlaybackStorageMedia": "NETWORK",
      "TransportPlaySpeed": "1",
      "CurrentTrackDuration": "00:03:50",
      "PossibleRecordQualityModes": "NOT_IMPLEMENTED",
      "Bitrate": "320",
      "PossibleRecordStorageMedia": "NONE",
      "AVTransportURI": "spotify-playlist://playback?cookie=3697683744",
      "RelativeTimePosition": "00:02:42",
      "RelativeCounterPosition": "1",
      "CurrentPlayMode": "NORMAL",
      "TransportState": "PAUSED_PLAYBACK",
      "AbsoluteCounterPosition": "1",
      "CurrentTransportActions": "Play,Previous,Next,Seek,Repeat,Shuffle",
      "RoomStates": "uuid:5a1721c8-e328-4d4c-affb-8be13f407cbf=STOPPED,uuid:bb4421cf-9763-439e-bc2c-77fe65f062db=STOPPED,uuid:f0bf7db5-a18f-47a3-992e-f19445bd2edf=STOPPED,uuid:4a721c47-3476-474f-8071-190132807689=STOPPED,uuid:6558c390-87ee-4b90-965e-955a6f70b8fc=STOPPED",
      "ContentType": "OGG",
      "NumberOfTracks": "1",
      "SleepTimerActive": "0",
      "TransportStatus": "OK",
      "CurrentTrackURI": "spotify-track://586",
      "RoomVolumes": "uuid:5a1721c8-e328-4d4c-affb-8be13f407cbf=-37,uuid:bb4421cf-9763-439e-bc2c-77fe65f062db=23,uuid:f0bf7db5-a18f-47a3-992e-f19445bd2edf=-35,uuid:4a721c47-3476-474f-8071-190132807689=-50,uuid:6558c390-87ee-4b90-965e-955a6f70b8fc=-32",
      "Volume": "23",
      "RoomMutes": "uuid:5a1721c8-e328-4d4c-affb-8be13f407cbf=0,uuid:bb4421cf-9763-439e-bc2c-77fe65f062db=0,uuid:f0bf7db5-a18f-47a3-992e-f19445bd2edf=0,uuid:4a721c47-3476-474f-8071-190132807689=0,uuid:6558c390-87ee-4b90-965e-955a6f70b8fc=0",
      "rooms": [
          "roomUDN": "uuid:6558c390-87ee-4b90-965e-955a6f70b8fc",
          "name": "Balkon",
          "PowerState": "AUTOMATIC_STANDBY",
          "online": true,
          "TransportState": "STOPPED",
          "Volume": "-32",
          "Mute": "0",
          "udn": "uuid:6558c390-87ee-4b90-965e-955a6f70b8fc",
          "powerState": "AUTOMATIC_STANDBY",
          "renderer": [
              "udn": "uuid:c228f8b3-4928-4635-a9d6-1508ddfd70c9",
              "name": "Connector Balkon"
          "roomUDN": "uuid:bb4421cf-9763-439e-bc2c-77fe65f062db",
          "name": "Studio",
          "PowerState": "ACTIVE",
          "online": true,
          "TransportState": "STOPPED",
          "Volume": "23",
          "Mute": "0",
          "udn": "uuid:bb4421cf-9763-439e-bc2c-77fe65f062db",
          "powerState": "ACTIVE",
          "renderer": [
              "udn": "uuid:dc0ca721-b6e4-4231-b851-723621584a15",
              "name": "Connector Studio"
          "roomUDN": "uuid:f0bf7db5-a18f-47a3-992e-f19445bd2edf",
          "Volume": "-35",
          "Mute": "0",
          "name": "Bad",
          "PowerState": "ACTIVE",
          "online": true,
          "TransportState": "STOPPED",
          "udn": "uuid:f0bf7db5-a18f-47a3-992e-f19445bd2edf",
          "powerState": "ACTIVE",
          "renderer": [
              "udn": "uuid:9a3d71b9-7310-4edc-9fca-db884c9a9cb8",
              "name": "Connector Bad"
          "roomUDN": "uuid:4a721c47-3476-474f-8071-190132807689",
          "Volume": "-50",
          "Mute": "0",
          "name": "Wohnzimmer",
          "PowerState": "ACTIVE",
          "online": true,
          "TransportState": "STOPPED",
          "udn": "uuid:4a721c47-3476-474f-8071-190132807689",
          "powerState": "ACTIVE",
          "renderer": [
              "udn": "uuid:a97b4818-a983-4ccb-8e7f-8394482ee5c6",
              "name": "Connector Wohnzimmer"
          "roomUDN": "uuid:5a1721c8-e328-4d4c-affb-8be13f407cbf",
          "Volume": "-37",
          "Mute": "0",
          "name": "Schlafzimmer",
          "PowerState": "ACTIVE",
          "online": true,
          "TransportState": "STOPPED",
          "udn": "uuid:5a1721c8-e328-4d4c-affb-8be13f407cbf",
          "powerState": "ACTIVE",
          "renderer": [
              "udn": "uuid:f234b30a-73e6-4f9f-bd88-095f367a19b0",
              "name": "Speaker Schlafzimmer #2"
      "udn": "uuid:ffffffff-da76-1a81-ffff-ffffda761a81",
      "mediaItem": {
        "class": "object.item.audioItem.musicTrack",
        "section": "Spotify",
        "name": null,
        "durability": null,
        "childCount": null,
        "id": "0/Spotify/Track",
        "parentID": "0/Spotify",
        "restricted": "0",
        "title": "Blue Kind (feat. Enlery)",
        "description": null,
        "artist": "7 Skies",
        "albumArtURI": "",
        "genre": null,
        "album": "Blue Kind (feat. Enlery)",
        "date": null,
        "creator": null,
        "originalTrackNumber": null,
        "duration": "0:03:50.000",
        "protocolInfo": "spotify:*:audio/spotify-track:*"
      "friendlyName": "Schlafzimmer,Studio,Bad,Wohnzimmer,Balkon",
      "host": "",
      "manufacturer": "Lautsprecher Teufel GmbH",
      "modelNumber": "2"

I had an error when using “$[0].rooms.1.Volume”, now with this new JSONPATH my logfile is clean but the item state is UNDEF

JSONPATH:$.data[0].rooms[1].Volume use the full path


I’m having problems getting the value of a Rollershutter Item. I have defined my http thing and channels like this:

Thing http:url:garage "Garage" [ baseURL="", refresh=60, commandMethod="POST", contentType="text/plain"] {
        Type rollershutter : shutter "Shutter" [ stateExtension="get", commandExtension="set"]

The items look like this:

Rollershutter GarageRollershutter "Garagentor" (gDoorShutters) { channel="http:url:garage:shutter" }

Whenever a get is performed, my GarageRollershutter becomes UNDEF. There is no further information in the logs as to what the exact problem is:

12:00:32.199 [TRACE] [http.internal.http.RefreshingUrlCache] - Requesting refresh (retry=false) from '' with timeout 3000ms
12:00:32.200 [TRACE] [http.internal.http.RefreshingUrlCache] - Sending to '': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.20.v20190813}, Content = {null}
12:00:32.386 [TRACE] [tp.internal.http.HttpResponseListener] - Received from '': Code = {200}, Headers = {Content-Type: text/plain, Content-Length: 2, Connection: close}, Content = {50}
12:00:32.389 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'GarageRollershutter' changed from 50 to UNDEF

I have set the the value of the item via REST to 50 before the get, so setting percentage values should work. As there is no transformation involved, I am a little bit puzzled on what else to try.

Does anybody have an idea?

Edit: it does not matter which value is returned by the get call, i tested with 0, 50 and 100.

@moderators can we close this thread? Development is done and I feel that adding every issue and question to this thread might not be the best idea if we want to keep track of questions/solutions.

1 Like