[http] refresh and delay

Hi, although this is a rather mature topic, I would like to come up with a question about your statement

Please note that channels with the same stateExtensiob are refreshed with one request.

I am using openHABian on a RPI4 / 8GB; openHAB version 4.0.3. The HTTP binding is used to get data from a Rademacher HomePilot with really many (200+) devices.

I was expecting timeouts of some requests, but they came way sooner than expected. Anyhow, I used the “delay” setting for rate limiting, which solved the issue of timeouts so far. Update rate was 5 seconds, delay 100ms, which seems to make sense to me for something around 10 different stateExtensions.

Adding more devices, I ended up with several hundred different channels all using the same stateExtension.
And then, I found this warning in the log:

2023-09-20 21:26:48.645 [WARN ] [nding.http.internal.HttpThingHandler] - 133 channels in thing http:url:HomePilot with a delay of 100 incompatible with the configured refresh time. Refresh-Time increased to the minimum of 14

For me, this looks like every channel including those with identical stateExtensions query the same address allover and over again instead of the expected auto-caching (and then parsing the answer for the different channels. Which would also explain my HomePilot device heating up unexpectedly :wink:

Or is there something I have to configure to make the HTTP binding explicitely aware which channels are actually using the same extension?

The Thing config looks as such:

Thing http:url:HomePilot "HomePilot" [
    baseURL="http://<myIP>/",  //your HomePilot IP
    authMode="BASIC",
    ignoreSSLErrors="true",
    refresh=5,
    commandMethod="PUT",
    stateMethod="GET",
    contentType="application/json",
    timeout=3000,
    bufferSize=2048,
    delay=100
] 

the channel definitions look like this:

// -----------------------------------------------
        Type string : Schaltkontakt_Steckdose_Balkon "Schaltkontakt Steckdose Balkon" [
        stateExtension="/v4/devices?devtype=Sensor",
        stateTransformation="JSONPATH:$.meters[?(@.did==<myDID1>)].readings.contact_state"
        ]
// -----------------------------------------------
        Type string : Schaltkontakt_Licht_Balkon "Schaltkontakt Licht Balkon" [
        stateExtension="/v4/devices?devtype=Sensor",
        stateTransformation="JSONPATH:$.meters[?(@.did==<myDID2>)].readings.contact_state"
        ]
// -----------------------------------------------
        Type string : Schaltkontakt_Steckdose_Terrasse_SchlafZi "Schaltkontakt Steckdose Terrasse im Schlafzimmer" [
        stateExtension="/v4/devices?devtype=Sensor",
        stateTransformation="JSONPATH:$.meters[?(@.did==<myDID3>)].readings.contact_state"
        ]
// -----------------------------------------------

as I mentioned, there are 100+ definitions which look like this or similar, and they all share the stateExtension="/v4/devices?devtype=Sensor", which returns roundabout 26kB of JSON data containing all required information to do parsing for all channels with this extension.