Http Binding cached Item instable

Hello Community,

I configured some (about 20) Items using same http-Request with json-Transformation.
All working fine.

To reduce Network-Usage I put http://Server/json?parameters=123 in http.cfg like
Status.url=http://Server/json?parameters=123
Status.updateInverval=60000

Replaced http://Server/json?parameters=123 with Status.url

Syntax is correct.

Since using cached Item I dont get Item Updates anymore.

While testing remember another item using http cache: Should run every 15 Minutes but only gets updates irregular sometimes after 2, sometimes after 3 days, sometimes twice a day.

Any idea how to search? Is there a problem with cached Items in Version 2.5.4? Where is the storage for the cache, so I could look for requested file.

What’s the Item config? Keep in mind there are two polling periods. There is the updateInterval in http.cfg which controls how often the binding pulls the data from the URL. And on the Item there is a number that represents how often the Item pulls data from the cache.

http.cfg

R2D2_Status.url=http://10.10.10.161/json?user=BLA&pass=NOCHMALBLA&cmd=status
R2D2_Status.updateInterval=30000

Works fine:

Number    R2D2X_Status           "R2D2X Status Direkt [MAP(robonect_status.map):%s]"         (gR40, gR40Chart2, gHistoryMi, gHistoryCh) { http="<[http://10.10.10.161/json?user=BLA&pass=NOCHMALBLA&cmd=status:60000:JSONPATH($.status.status)]"}

Doesnt work:

Number    R2D2X_Status           "R2D2X Status Direkt [MAP(robonect_status.map):%s]"         (gR40, gR40Chart2, gHistoryMi, gHistoryCh) { http="<[R2D2_Status:60000:JSONPATH($.status.status)]"}

Any errors in the logs?

No Errors in the log and no changes in event.log :frowning:

Just trying item for Item, with only 2 or 3 Items with cache it seems to work.

I have some Items with JSONSPATH gave a (ONE TIME ONLY) warning in Logs (no Error), because those json tree only sometimes in JSON. Maybe those warning causes http to stop?

.alarm.alarmvalue: 20

only exists if alarm is true.

Could that be the reason?

That is possible.
You may have to do your data extraction in a rule where you can take decisions about missing parts.

So ohne suggestion and a question:

Suggestion:
In log should reported an error then and message http will fully stop from now.

Question:

Do you have an example for rule reading Json and overgive to item?

Row with item.sendCommand(…) is enough :wink:

No, I’m not writing rules for you.

The first thing you would need to do is to get the “whole raw message” into a String type Item, so that you could process it in a rule. You might as well set that up anyway, as it is a diagnostic step in itself.

Now I’ve slept on it, I’m not so persuaded your “missing-JSON” errors are related to your “irregular updates”.
Each Item with a JSON transform should be doing its work individually. It’s hard to see how one messing up could mess up any others.
Using a rule to do your JSON processing certainly will be tidier for you, instead of having a config that you know will produce errors. But I do not now think it would help your general updates.

So let’s look at general http.cfg
Is that it, just the two lines you’ve shown us? I would look at increasing the timeout from default 5s for a start.
What kind of service is the target? I see robonect mentioned - isn’t there a specific binding for that?

v1.x bindings make a working copy of the configuration file - http.config in this case - which can get out of step when you edit http.cfg.
Once you have .cfg as you want it, stop openHAB, delete the http.config version, restart OH (the file will be recreated)

The target is a robot lawn mower with an api.

The robonect binding don’t work very well. Reduced informations, slow and unstable updates, …

This api has some json trees only if others has special values. For example: with alarm on you got details of alarm. Otherwise tree not in json.

I don’t want you to write my rules, sorry if my English causes this mistake.

Just thought maybe you or somebody else has an example in rules how to get json and transform in one row.

Fair enough. You might be dealing with the same issues here!

Sure, there is a forum full of them.



You can use REGEX to check if some field is or is not present in your JSON.
Or, you can test for JSONPATH failure in this way -