HTTP binding - optimizing state requests

Good morning,

I’m using the HTTP binding to access the IPX800v4 JSON API. Up to now, everything is working fine and I am able to toggle 48 relays through 48 channels/items of type ‘switch’.

However, the IPX800 is not able to return the state of a single relay. Instead, it returns all of them in a single call. That means for each channel, the ‘stateExtension’ (or url) is the same and the only difference is the ‘stateTransformation’ used to get the correct relay number. That also means 48 times the same request and the same answer to/from the appliance, i.e. :

http://1.2.3.4/api/xdevices.json?key=apikey&Get=R

How would it be possible to query only once the state for multiple channels ?

One possibility would be from the Thing level, but it does not appear to be supported. Another possibility would be through a local caching proxy on the openhabian box, but it is overkill.

Any suggestion ?

What makes you think that? Can we see your current configuration?

View the Thing as managing your HTTP transaction, and the channels as the data interface between your transaction an openHAB. One Thing/transaction may have many channels.

This should happen automatically if the requests are tob the same address.

Indeed.

If I set ‘TRACE’ logging level on http binding, and as long as the url is the same for multiple channels, only one request is launched.

Next time I’ll check the logs before posting :blush:

Cheers

2 Likes