Rate limiting HTTP commands

  • Platform information:
    • openHAB version: 3.1

I have a thing configured as follows:

Thing http:url:test "Test"
[
    baseURL="some_url", timeout=1000, delay=10000, refresh=100000
]
{
    Channels:
        Type switch : switch1 "Switch1"
            [mode="WRITEONLY", commandExtension="command1", onValue="ON", offValue="OFF"]
        Type switch : switch2 "Switch2"
            [mode="WRITEONLY", commandExtension="command2", onValue="ON", offValue="OFF"]
}

This is interfacing with a device that switches 2 lights on and off - it only gives me an interface to toggle each light on and off (it doesn’t provide me with any way of querying whether the light is currently on or off). I’ve linked items such as:

Switch Switch1 { channel="http:url:test:switch1" }

and it works fine - the lights switch on and off as I require.

However, behind the scenes, the device which I am calling here is quite slow and needs roughly 1-2 seconds between calls to work reliably. I added the “delay” parameter to the thing above (with a very conservative 10 seconds as the value) hoping that this would throttle the requests, but it appears I can still trigger 2 calls via a UI linked to my items quickly and cause problems.

Am I misusing the delay parameter? Is there another way of throttling these requests?

I’ve never used delay, so I can’t directly help you. However, your question is very similar to this recent discussion:

If you are talking about rate-limiting commands: that is not implemented in the openHAB version of the http binding. Only state-Requests are rate-limited.

1 Like