nibi79 / worxlandroid

openHAB Binding for Worx Landroid
57 stars 20 forks source link

404 from api.worxlandroid.com #70

Closed mitch-geht-ab closed 1 year ago

mitch-geht-ab commented 1 year ago

Hi @nibi79

new year, new problems. Suddenly I get 404 errors from api.worxlandroid.com.

From Openhab3.3 Logs:

2022-09-28 19:13:41.952 [DEBUG] [nternal.webapi.request.WebApiRequest] - URI: https://api.worxlandroid.com/api/v2/oauth/token
2022-09-28 19:13:42.507 [ERROR] [ternal.webapi.WorxLandroidWebApiImpl] - Error connecting to Worx Landroid WebApi! Error = Error calling Worx Landroid WebApi! HTTP Status = 404

Had allready removed the mower from my account an reconnected it, no luck.

Following from a mitmproxy dump:

Request:

POST  https://api.worxlandroid.com/api/v2/oauth/token HTTP/1.1
Accept-Encoding:    gzip
User-Agent: Jetty/9.4.46.v20220331
Content-Type:   application/json
Host:   api.worxlandroid.com
Content-Length: 175
{
  "grant_type":"password","client_secret":"xxxxxxxxxxxxx","username":"xxxxxxxxx","password":"xxxxxxxxxxxx","scope":"*","client_id":1,"type":"app"
}

Response:

HTTP/1.1 404 Not Found
Date:   Wed, 28 Sep 2022 17:13:42 GMT
Content-Type:   application/json
Transfer-Encoding:  chunked
Connection: keep-alive
Server: nginx
Vary:   Accept-Encoding
Cache-Control:  no-cache, private
Content-Encoding:   gzip
{
  "message":"Not Found","code":"404.000"
}

As usual, no change from my side. Landroid App on my Android is working.... Login to https://id.eu.worx.com/login is working...

Could it be, that Worx or AWS-Iot has changed sth. on the OAuth procedure? Maybe to "/api/v3/" ?? But it should affect more people than me.

BR Mitch

mitch-geht-ab commented 1 year ago

Seams like ioBroker had the same problem but got it fixed by TA2k. Quick lock into the code confirms that worx had changed sth. on the auth method. From bearer token to sth. complete different :(

Issue on iobroker: https://github.com/iobroker-community-adapters/ioBroker.worx/issues/569

Solution see commits from TA2k from Sep. 28th: https://github.com/iobroker-community-adapters/ioBroker.worx/commits/master

I fear the changes are a bit more voluminous. Maybe worth to have a short chat with TA2k @nibi79

From my point of view, I'm a bit shocked to kill bearer token and switched to this form-based rebuild sth. construct.

BR Mitch

nibi79 commented 1 year ago

I have already written to TA2k. I have a problem to implement this in Java because I don't understand the lines from 497 of the code or the behavior: https://github.com/iobroker-community-adapters/ioBroker.worx/blob/98cebed3758212d947d6a2284e571e29ec06630d/lib/api.js#L497 What is the trigger for this catch to get the code or how to imlement this? I agree with youi that this form based solution is not that great.

RolandRosenfeld commented 1 year ago

Don't know whether this helps, but in HomeAssistant there is also much information about the issue and how to fix it. An explanation of the workflow is in https://github.com/MTrab/landroid_cloud/issues/259#issuecomment-1266374541 and the resulting merge is in https://github.com/MTrab/pyworxcloud/pull/85

nibi79 commented 1 year ago

Maybe someone of you has Python skills and can analyze this solution and explain to me how it works? Otherwise I have to learn a little bit python...

nibi79 commented 1 year ago

the solution is not described in the mentioned commment

nibi79 commented 1 year ago

this new beta version should fix this issue:

https://github.com/nibi79/worxlandroid/releases/tag/v3.2-beta

Please test this veriosn and let me kow if it works for you!

thank you

martinlindjarv commented 1 year ago

Thank you!

Changed jar in addons folder and reenabled landroid bridge trough config.

According to logs all seem to work :)

2022-10-05 17:01:24.642 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'landroid.things'
2022-10-05 17:01:25.960 [INFO ] [d.internal.WorxLandroidBridgeHandler] - Start retrieving AWS certificate
2022-10-05 17:01:27.594 [WARN ] [ernal.webapi.response.WebApiResponse] - Cannot get response as JsonObject
2022-10-05 17:01:28.606 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'landroid.things'

Not sure if that JsonObject is something important or not ...

But buttons started to work and turning on party mode trough OH changed it in original app as well :)

sihui62 commented 1 year ago

let me kow if it works for you!

Works like a charme, @nibi79, you are the man of the day, thanks a ton :-)

RolandRosenfeld commented 1 year ago

I replaced the jar and restarted openhab and now all my items are available again and everything seems to be online. This is with openhab 3.1 and a Landroid Worx WR105SI SO500i.

Many thanks to @nibi79 for this great job!

PilotIoTSystems commented 1 year ago

Thanks @nibi79, I've been using Binding successfully for a year. I made really good rules for it (gate closes when mowing, etc.) and ever since it stopped working, I really miss it. My problem is that, like many others, I'm using org.openhab.binding.worxlandroid-2.5.3-SNAPSHOT.jar for OpenHab 2.5 (there are many reasons I haven't migrated to OpenHab 3). Please, if you have already managed to patch the v3.2-beta, prepare the patch for the v2.1 version as well! Besides me, many people would be happy about it. Thanks in advance!

TottiWhat commented 1 year ago

Works perfectly! Thanks very much for that great binding and your immediate effort to fix that issue!

nibi79 commented 1 year ago

Thank you all for your feedback!

@martinlindjarv "Cannot get response as JsonObject" doesn't matter

@PilotIoTSystems I'm really sorry, but it's too much effort and I just don't have the time. I'm glad that I can take care of the binding at all and solved this problem. Maybe later but I can not promise anything.

nibi79 commented 1 year ago

Many thanks to @TA2k (ioBroker) and @MTrab (HomeAssistant) for their support!!!