How to get HTTPbinding working with cache and json

Hi I am trying to get data from my Central Heating. I can see the JSON on my browser when I put this in the address bar:<1611f022270>
I get:

 {"nodenr": 241,
"ch_temp_lsb": 195,
"ch_temp_msb": 14,
"rfstatus_cntr": 0}

I checked the JSON in the evaluator and this works: $.ch_temp_lsb
So first I tried an item:

Number CV_data "CV-json-temp: [%.1f °C]" { http="<[<1611f022270>:10000:JSONPATH($.ch_temp_lsb)]" }

This gives me the error:
18-01-28 10:57:37.350 [ERROR] [b.core.service.AbstractActiveService] - Error while executing background thread HTTP Refresh Service

When I do it in the services/http.cfg:

with item:
Number CV_data_1 “CV-json-temp: [%.1f °C]” { http="<[CV_data:600000:JSONPATH($.ch_temp_lsb)]" }
I get the same errors.

Also when I use this url with < as %3C<1611f022270>

The JSONPATH-ad-on is installed.
What do I do wrong?

For debugging try to change number into string and see what is the result

change it to:

String CV_data "CV-json-temp: [%s]" { http="<[<1611f022270>:10000:JSONPATH($.ch_temp_lsb)]" }

Just a shot in the dark:

Maybe < and > are causing problems here since those are direction markes for the http binding itself.
Could you try to escape them in your url?

Try:\<1611f022270\> (but i am not sure about this)

< = %3C and > = %3E

I have used to determine the correct escape sequences.

Thank you for helping. I did try with %3C, now also with a ’ \ ’ infront, no luck.
String doesn’t help either.

How long does it take to retrieve the data from the heater?

I think we had a problem here some time ago with a device that needed much time to responding and openHAB had thrown a timeout exception then.

Also you could try to use the String item without jsonpath, just to double check that nothings going wrong there.

Thanks for your idea. I am not at home now. I will time through the browser when I am back.
I remember I should be able to change the time-out-setting somewhere.

Back home… Ping from my raspberrypi takes 7 to 9 ms. I cannot use the browser from the command line, but using the browser from my laptop it takes maybe 1 /10th of a second to get the jason-data back.
Also when using String as item and ‘default’ in stead of JSONPATH, I get the same error.
String CV_data “CV-json-temp: [%s]” { http="<[<1611f022270>:10000:JSONPATH($.ch_temp_lsb)]" } gives the http-error.
I tryed this just skipping the < and >:
String CV_data “CV-json-temp: [%s]” { http="<[$.ch_temp_lsb)]" }
And that finally gives me something and no http-errors. Not yet what I want, but the problem must be in the < and >.
Unfortunately i really need them!

UPDATE: I escaped with / which just didn’t work. Now I escaped correctly with \ and I get yet anouther error in the log:
2018-01-28 18:12:13.871 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘default.items’ has errors, therefore ignoring it: [80,49]: mismatched character ‘<’ expecting set null

Sorry i am out of ideas for now. :neutral_face:
Maybe someone else knows the trick.

If i have another ides i will add it here.

Thanks anyway! Indeed, if anybody else has any idea, I’m so close, i really need to crack this one!

Succes! It turns out to be Incomfort-related (the heating Lan2RF that I use).
I played around in my browser and discovered that I could skip the last >. But when I skip the first < in front of the number, I got ziro.
Then I discovered that I could just as fine replace the ‘<’ with anouther sign. I found that ’ _’ does the trick and also works for the http-binding.
This does not work in the http.conf-file unfortunately, but it does work in the item-file. This means however that I have 10 GET’s in stead of one, and that the data may change betwee these GET’ s. That is not good since my temperatures are split in lsb and msb and have to be combined t get the real number.
Actually I think this is a http-binding bug. Should I somehow file a bug-report? I cannot find where to file a bugreport for the http-binding?

  1. Nice to hear that you found a (at least temporary) solution

  2. The http binding is a 1.x binding and can be found here:

The issue should be reported here:
Thanks in advance for filing the issue. :slight_smile:

Or I re-read the manual for 1000+1 times…
I have changed the config file, commented out and chaged:

# whether to substitute the current time or state value into the URL
# (optional, defaults to true)

I did read this before, but I though it had to do specially with time. But then there is also something about special characters so I tried. Now it’ s working as intended.
Thanks for your help and patience!

1 Like

Haha, sometime it’s that easy.
I didn’t recognize this line until you pointed me at it now.

Now i will never forget about it anymore. :laughing:

Good, that makes me a bit less stupid for keeping you bussy all afternoon :rofl: .