Openhab3 http migration

After migration to openhab3 there is still the task left to migrate http-Things to openhab3 so to http2

I searched and tried a lot, but I don’t get it to work.

Old http1:

Switch    R2D2_Basis            "R2D2 go Home (dauerhaft)"                              (gR40)                                          { http=">[ON:GET:]" }

I tried in new http2 binding with things configuration and items:

Thing http:url:r2d2commands "HTTP: R2D2 Commands" [ baseURL="", commandMethod="GET",
                                                    username="USER", password="PASS",
                                                    timeout="10000", refresh="90" ] {
        Type switch : mode-home   "Mode Home" [ mode="WRITEONLY", commandExtension="xml?cmd=mode&mode=%2$s", onValue="home", offValue="home" ]
Switch    R2D2_Basis            "R2D2 go Home (dauerhaft)"                              (gAll, gR40)                                            { channel="http:url:r2d2commands:mode-home" }

I tried with traces, tried a connection to my webserver too (there the right get is shown, directly working on API if used by browser), but the Mover didn’t react to this command if send via http binding.

In openhab with trace on I can see:

2021-04-01 23:28:39.281 [TRACE] [nding.http.internal.HttpThingHandler] - Sending to 'http://10.XX.XX.XXX/xml?cmd=mode&mode=auto': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.20.v20190813}, Content = {null}

But no errors. Anyone has got an Idea whats my mistake?

In your v1 config you’re sending your username and password as part of the URL string. Why didn’t you do that for the v2 version? The Thing parameters that you’ve set for username and password will be sent with the headers, which doesn’t seem to be what you’re doing in the v1 version?

I allready tried, same result. Just for you to know: Ich not within Request, it uses normal basic authentification

Well, I’d at least put that back in to be closer to your v1 config.



this from your log shows mode=auto - did you mean to send that? From other bits of your configuration it looks like you’re trying to send mode=home?

Sorry, had more than only one, so copied wrong line from log. Its equal if mode=home, mode=eod, mode=auto, everywhere the same :frowning:
Just didnt want to give you a long list of channels and items, because all same syntax and no one working

As it uses http protocol use a network sniffer and trace what exactly the browser sends and what exaclty the binding sends.
E.g. does the user-agent matter ?

I changed back to sending username and password in url now, played with the Timeouts and the delay and now it works. Think had been an overload of the device before :crazy_face:

Thank you for assistance