Gardena Binding is not working anymore (HTTP 403 forbidden)

Hello openHAB community,

since today my Gardena Bindung 2.4.0 is not working anymore.
I am on openHabian with openHAB 2.4.0 stable.

2019-02-25 17:38:22.848 [hingStatusInfoChangedEvent] - ‘gardena:account:a4c3e5cc’ changed from UNINITIALIZED to INITIALIZING

2019-02-25 17:38:23.094 [hingStatusInfoChangedEvent] - ‘gardena:account:a4c3e5cc’ changed from INITIALIZING to OFFLINE (COMMUNICATION_ERROR): Error 403 Forbidden

Any idea?
Somebody with the same problem?

Tanks in advance!
Lukas

same here. Can anyone help out?

Hier ist die Anwort von Gardena zu diesem Thema:

Wir bedauern die Ihnen entstandenen Unannehmlichkeiten durch unser smart system sehr.

Für die genaue Ursache dieses Fehlers haben wir leider keine zweifelsfreie Erklärung.

Am gestrigen Montag wurde durch den Push die URLs umgestellt, was zur Folge hat, dass eine neue API besteht.
Wir können uns vorstellen, dass dies möglicherweise die Ursache für Ihr Anliegen ist.

Wir hoffen, dass Ihnen diese Informationen weiterhelfen.

Für weitere Fragen stehen wir Ihnen gern zur Verfügung.

Freundliche Grüße

i. A. Stefan Harder
GARDENA Service
Hans-Lorenser-Str. 40
89079 Ulm

2019-02-26 14:00:32.222 [TRACE] [ng.gardena.internal.GardenaSmartImpl] - POST request: https://smart.gardena.com/sg-1/sessions
2019-02-26 14:00:32.223 [TRACE] [ng.gardena.internal.GardenaSmartImpl] - POST data : {“sessions”:{“email”:“xxxx”,“password”:“xxxxxxx”,“sessionTimeout”:30,“connectionTimeout”:10,“refresh”:60}}
2019-02-26 14:00:32.477 [TRACE] [ng.gardena.internal.GardenaSmartImpl] - Status : 403
2019-02-26 14:00:32.478 [TRACE] [ng.gardena.internal.GardenaSmartImpl] - Response: {“message”:“Missing Authentication Token”}

2019-02-26 14:00:32.478 [DEBUG] [ternal.handler.GardenaAccountHandler] - Disposing Gardena account ‘home’
2019-02-26 14:00:32.479 [DEBUG] [ternal.handler.GardenaAccountHandler] - Error 403 Forbidden
org.openhab.binding.gardena.internal.exception.GardenaException: Error 403 Forbidden
at org.openhab.binding.gardena.internal.GardenaSmartImpl.executeRequest(GardenaSmartImpl.java:487) ~[?:?]
at org.openhab.binding.gardena.internal.GardenaSmartImpl.verifySession(GardenaSmartImpl.java:498) ~[?:?]
at org.openhab.binding.gardena.internal.GardenaSmartImpl.loadAllDevices(GardenaSmartImpl.java:213) ~[?:?]
at org.openhab.binding.gardena.internal.GardenaSmartImpl.init(GardenaSmartImpl.java:151) ~[?:?]
at org.openhab.binding.gardena.internal.handler.GardenaAccountHandler.lambda$0(GardenaAccountHandler.java:75) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
at java.lang.Thread.run(Thread.java:745) [?:?]
Caused by: org.openhab.binding.gardena.internal.exception.GardenaException: Error 403 Forbidden

They indeed did change the API. You need to retrieve a session token first based on your email address and password which in turn acts as a bearer authorization header. That’s what I learned from a quick look at the network requests. Don’t know if anything else has changed.

yep, that is what I guessed but dont see anything in their “smart” portal that would let you grab a token.

It’s the first POST request to https://smart.gardena.com/v1/auth/token.
Submitted data is {“data”:{“type”:“token”,“attributes”:{“username”:“test@test.com”,“password”:“PASSWORD”}}}

I got the same problem, any new ideas? New message is : Gardena%20openhab%20Prob

get the token via curl seems to work:

curl -s --data ‘{“sessions”:{“email”:"???@???",“password”:“xxxxxxxxx”}}’ --header “Content-Type:application/json” https://sg-api.dss.husqvarnagroup.net/sg-1/sessions
{“sessions”:{“token”:"???-7c9c-4a6b-90af-2b637cb8728e",“user_id”:"???-4583-4b4e-a01e-8bf605ba68e9",“refresh_token”:"???-625a-4c21-8c90-560e619a64f8"}}

=> the binding is still offline:
image

I changed the API endpoints and response structure to get the token and authorization provider from the new API.
https://markus.plutka.de/org.openhab.binding.gardena-2.5.0-SNAPSHOT.jar

I didn’t have time yet to test it intensively so USE AT YOUR OWN RISK!
If it works it is still only a temporary solution until the original author decides to fix it.

2 Likes

Thx for fixing it - for me its working now …

What would a 2.4.0 user need to do to get this working?

This JAR should work for 2.4.0 too.
Simply put it in your addons/ folder (e.g. /usr/share/openhab2/addons/) and restart openhab.
Please remember to REMOVE it again when you update openhab2 with an updated version of this binding.

1 Like

Well, that works perfectly. You, sir, are a wizard!

for me its works too. But I get an warning in the log…

2019-03-02 20:44:33.758 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler GardenaAccountHandler tried updating the thing status although the handler was already disposed.

For me this workaround didn’t work.

openHAB 2.5.0 Build #1533

image

reboot openhab, try to reconnet to Gardena Smart Home Account

image

In the logfile I have the same entry as Cernon

2019-03-03 13:27:15.768 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler GardenaAccountHandler tried updating the thing status although the handler was already disposed.

you have a tip for me?

After I removed the binding, restarted openHAB, reembedded the Gardena Binding the status is back to Online :slight_smile:

Thanks.

Hi - just wondered if the new binding has been merged into the latest openHAB version?

thanks,

Dan

Same question here as I consider buying a Gardena system or another one

Not sure this is the same problem, but I always loose connection and see the following error inside the gardena app:

Same for me. I had to deactivate the binding (removing the account data) in order to make the app work again as previously. More info here: https://github.com/openhab/openhab2-addons/issues/5815