[http] Binding failed successfully

Hi there,
I guess I am doing something wrong. I linked the HTTP binding to an API that can control my roller shutter. It does work, the roller shutter moves, no errors on that bridge. But I have a warning in the logs, that is bugging me (and sends me telegraf-messages)…

22:33:25.844 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'WCRollladen_Steuerung' received command STOP
22:33:25.848 [TRACE] [inding.http.internal.HttpThingHandler] - Sending to 'http://172.16.10.11/api/devices/145/action/stop': Method = {POST}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.20.v20190813, Content-Type: application/json}, Content = {stop}
22:33:25.901 [TRACE] [tp.internal.http.HttpResponseListener] - Received from 'http://172.16.10.11/api/devices/145/action/stop': Code = {202}, Headers = {Server: nginx/1.8.0, Date: Sat, 27 Feb 2021 22:04:13 GMT, Content-Type: application/json;charset=UTF-8, Transfer-Encoding: chunked, Connection: keep-alive, Cache-Control: no-cache, no-store}, Content = {{"id":0,"jsonrpc":"2.0","result":{"result":0}}}
22:33:25.902 [WARN ] [tp.internal.http.HttpResponseListener] - Requesting 'http://172.16.10.11/api/devices/145/action/stop' (method='POST', content='org.eclipse.jetty.client.util.StringContentProvider@44c72449') failed: 202 Accepted
22

That last line … it seems as if code 202, although that means “accepted” brings the session to a failed state

UID: http:url:HomeCenterLight
label: HomeCenterLight via REST-API
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: false
  baseURL: http://172.16.10.11/api/devices
  password: ****
  refresh: 1200
  commandMethod: POST
  contentType: application/json
  timeout: 3000
  username: ****
  bufferSize: 2048
channels:
  - id: 145_Steuerung
    channelTypeUID: http:rollershutter
    label: Steuerung
    description: null
    configuration:
      mode: READWRITE
      commandExtension: /145/action/%2$s
      stateTransformation: JSONPATH:$.[?(@.id==145)].properties.value
      downValue: close
      stopValue: stop
      upValue: open

Any ideas what I am doing wrong?
Thanks!
PhiL
Update: I am using OH3.0.1

The reason is that only 200/OK is considered as successful. The binding would need to be changed to accept 202/ACCEPTED as successful.

oh, really? As far as my understand goes, all codes between 200 and 299 are successfull. I’ll try to find that statement in the binding to make a pull request

oh, I just see, you are maintaining the binding yourself! so… when we are already talking. what do you think of changing that behavior ?

scrolling through: Jetty :: Project 9.0.0.RC0 API
there are dedicated methods for the each range…

I’m not maintaining any binding within openHAB any longer.

To answer your second question: yes. good change.

Bummer!

I’d woud say: Please make that pull request.

I will try. Never done that before, so I see a lot of preparation work (how to “build” the jar from the modified source code etc.) that I need to figure out. But I always wanted to try, now I have a reason :slight_smile:

1 Like