HTTP Binding, Handling JSON

Hey,

So I am stuck trying to display a simple number on my sitemap.
What I have done so far:

  1. Installed the HTTP Binding
  2. Created an item as follows (Basically identical to the example provided):
    Number temp_name “temp” { http="<[http://ip-address:port/data.json:60000:JSONPATH($.temp)]" }
  3. Added a field into my sitemap
    Text item=temp

Now, my item is displaying on the sitemap but my temp values are not, I have checked and the JSON endpoint is fine so I have no idea what the problem could be.

If anyone could help me, i’d be very grateful.

Thanks, Daniel.

I changed the data type to a String and I am getting the entire json response body so it seems it’s just JSONPATH that’s not working

Had to install the JSONPATH transform in the paper UI. Would be handy if that was mentioned in the HTTP Binding documentation with the JSONPATH example.

1 Like

I’m having similar issue but even removing JSONPATH from the item does not help. Here my items’ definitions:

  1. Number Sensor "Sensor" { http="<[http://192.168.0.24/json:JSONPATH($.Sensors[1].TaskValues[1].Value)]" }

  2. String SensorText "SensorText" { http="<[http://192.168.0.24/json]" }

URL http://192.168.0.24/json shows correct json data in web browser.

Please help.

https://docs.openhab.org/addons/bindings/http1/readme.html

Maybe you need to add the update interval!

<[http://192.168.0.24/json:6000:REGEX((.*))]"

Hmm. Most probably you’re right.
After fist look into the documentation I thought this is port, not interval. so I’ve skipped this :slight_smile:
I will check this out in the evening.

Thanks.

[EDIT]
Works now. Thanks!