# HTTP binding - openHAB 3 version

**URL:** <https://community.openhab.org/t/http-binding-openhab-3-version/101851>\
**Category:** Bindings\
**Tags:** openhab3\
**Created:** [July 5, 2020, 4:50pm UTC](https://community.openhab.org/t/http-binding-openhab-3-version/101851 "2020-07-05T16:50:08Z")\
**Posts on this page:** 1\
**Showing post:** 235

<div class="post-metadata">

**Author:** ![olialb](https://community.openhab.org/user_avatar/community.openhab.org/olialb/32/114437_2.png) [@olialb](https://community.openhab.org/u/olialb)\
**Post date:** [December 26, 2020, 5:28pm UTC](https://community.openhab.org/t/http-binding-openhab-3-version/101851/235 "2020-12-26T17:28:03Z")

</div>

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 luftdaten.info - #18 by NCO](https://community.openhab.org/t/solved-air-pollution-data-from-luftdaten-info/32137/18)

Now i get it running with the new binding. This thread helped me to make it and also the [documentation](https://next.openhab.org/addons/bindings/http/). 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 ([https://luftdaten.info/](https://luftdaten.info/))

The http request [http://feinstaubsensor-14255834/data.json](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:**

```auto
Thing http:url:feinstaub "Feinstaub" [baseURL="http://feinstaubsensor-14255834/data.json", refresh=10] {        
   Channels:            
      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_:

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

```

**And the Items:**

```auto
/* **************************
 * 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…

---

_[View the full topic](https://community.openhab.org/t/http-binding-openhab-3-version/101851)._
