Http binding question - cache not working

Greetings all, just starting out with openHAB 2.0, using openhabian on a RPi3. I am trying to use the http binding cache to grab data from an Arduino webserver via a simple rest interface to display oil and propane tank levels. Openhab reads the data successfully if an http item defined using a direct URL, but when using the cache feature it fails.

So for instance, http.items set up for direct URL works:

Number oilLevel { http="<[http://opentank.home/xml:10000:REGEX(.*?<oil>(.*?)</oil>.*)]" }

but this does not:

Number oilLevel { http="<[opentank.Cache:10000:REGEX(.*?<oil>(.*?)</oil>.*)]" }

where my cache settings in http.cfg are as follows:


Regex transformation is installed and working.

openhab.log shows this error but based on the wiki I cannot see what’s wrong with my http.cfg

2017-03-18 17:54:23.607 [ERROR] [ab.binding.http.internal.HttpBinding] - given config key 'format' does not follow the expected pattern '<id>.<url|updateInterval>'

What’s the best way to troubleshoot this?

Maybe you should remove the dot?
opentank.Cache used in Item, but opentankCache specified as cache name.

1 Like

Good catch, thank you very much.

I have the same error:

[ERROR] [ab.binding.http.internal.HttpBinding] - given config key 'format' does not follow the expected pattern '<id>.<url|updateInterval>'

and my configuration is:

MKTronic.url={Authorization=Basic YWRtaW46YWRtaW4=}

and usage:

String Relay1Status { http="<[MKTronic:2000:REGEX(.*?<relay1>(.*?)</relay1>.*)]" }

This comes from having the format configuration parameter in your http.cfg file.