[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 '': 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 '': 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 '' (method='POST', content='org.eclipse.jetty.client.util.StringContentProvider@44c72449') failed: 202 Accepted

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
  authMode: BASIC
  ignoreSSLErrors: false
  password: ****
  refresh: 1200
  commandMethod: POST
  contentType: application/json
  timeout: 3000
  username: ****
  bufferSize: 2048
  - id: 145_Steuerung
    channelTypeUID: http:rollershutter
    label: Steuerung
    description: null
      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?
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.


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