Home Connect binding

Hi,

I am afraid it happened again, I just noticed this morning.
From what I can see the token became invalid around one day after I had generated the new one:

2018-12-19 22:54:38.109 [ERROR] [nal.handler.HomeConnectBridgeHandler] - SSE token became invalid → close SSE
2018-12-19 22:54:38.292 [ERROR] [nal.handler.HomeConnectBridgeHandler] - Could not refresh token!

Can this be related to some change in 2.4.0?

Best regards,
Matt

I tried to restart the plugin with bundle:restart and also with bundle:stop / bundle:start but it didn’t help.
Right now, I tried to register once again but I can’t login in once I opened the verification url, so something else must be wrong right now.

But I also have to suspect that it has something to do with the 2.4 upgrade as it stopped working right after the upgrade.

Edit: Verification URL worked again so I have a brand new refresh token, but it still doesn’t work for me. I still get

Communication error! response code: 400, message: Bad Request, body: { “error”: “invalid_grant”, “error_description”: “invalid refresh_token” }

:frowning:

Thanks Jonas, that did the trick for me :wink:

Same for me.

'homeconnect:api_bridge:cb18b336' changed from OFFLINE (COMMUNICATION_ERROR): Communication error! response code: 400, message: Bad Request, body: {

  "error": "invalid_grant",

  "error_description": "invalid refresh_token"

} (Tried at Sat Dec 22 18:40:34 CET 2018) to OFFLINE (COMMUNICATION_ERROR): Communication error! response code: 400, message: Bad Request, body: {

  "error": "invalid_grant",

  "error_description": "invalid refresh_token"

} (Tried at Sat Dec 22 18:41:09 CET 2018)

Any news on this problem?

Hi,

I just release a new version of the binding. From now on the binding will update the oAuth refresh token configuration in the HomeConnect Bridge thing on every update. This should prevent the “invalid refresh token” error.

My guess is that the HomeConnect developer team removed old refresh token (> 3 months). Now the binding will always use the newest token. I think they worked on authentication and changed the way things worked. The UI on the developer site changed as well (some new settings are available).

@johannesbonn Can you please try the new version. Unfortunately you have to go through Setup Guide guide again and create a new initial refresh token.

Not sure. But I don’t think so. Just updated my installation to 2.4.0 as well. Will let you know.

Greetings,
JB

1 Like

Seems to run! Thank you! But I think we have to wait some days to see an effect. I will give you an info if I recognize something.

Greetings and I wish You nice christmas days!

Agree. In 24h the binding will have the first refresh.

1 Like

Got it working again. Somehow the binding got stuck, so I

  • Stopped openhab2
  • Removed the things file and the binding jar file
  • executed “openhab-cli clean-cache”
  • started openhab2
  • installed the binding again including all initial configuration

Thanks for your work. I’ll also check the following few days to see if it stays that way.

Seems to work without any problems! Thank you for your effort and work!

Thanks Jonas for the new version. Unfortunately the problem is still not solved for me. I just restarted OH and received again the “invalid refresh token” error.

Can you please post your error message. Strange thing it that my binding stopped working as well.

2018-12-30 16:02:28.084 [ERROR] [dler.AbstractHomeConnectThingHandler] - API communication problem while trying to update SIEMENS-SNxxxx-68A4xx9BF!
org.openhab.binding.homeconnect.internal.client.exception.CommunicationException: Communication error! response code: 400, message: Bad Request, body: {
  "error": "invalid_grant",
  "error_description": "invalid refresh_token"

At 16:02 CET. Do you know when your token became invalid. If it was around the same time I guess that the token was deleted on the HomeConnect server site. I will increase logging and also write to the HomeConnect team.

Can you please increase the log level of the binding via osgi shell

openhab> log:set DEBUG org.openhab.binding.homeconnect

I also installed the new binding snapshot, restartet OH and then the Pi but still had these error messages.

Yesterday, I repeated the initialization procedure as described in the binding manual. I.e., these curl calls. That createt, in the end, a new refresh token for me. I added this token to the PaperUI config. Since then, the plugin works as expected and my log is error-free.

Maybe you could also try to repeat the initialization process…

Thanks Jonas,

I cannot exactly tell you when the token became invalid. it was still working at 14:28. Then I had to restart OH at 16:08, thats when I noticed the error message:

2018-12-30 16:09:48.802 [ERROR] [dler.AbstractHomeConnectThingHandler] - API communication problem!
org.openhab.binding.homeconnect.internal.client.exception.CommunicationException: Communication error! response code: 400, message: Bad Request, body: {
  "error": "invalid_grant",
  "error_description": "invalid refresh_token"
} (Tried at Sun Dec 30 16:09:48 CET 2018)

I’ll increase the logging and let you know if it happens again.

Thanks,
Matt

Hi Michael,

thanks for your reply. Actually that is what I am doing to get it working every time when the refresh token gets invalid.

I have increased the log level. Is it normal/expected to get duplicate SSE-ALIVE messages every time with the exact same timestamp?

2018-12-30 21:21:09.287 [DEBUG] [internal.client.HomeConnectApiClient] - [SIEMENS-SX878D16PE-xxxxxxxxxxxx] SSE KEEP-ALIVE
2018-12-30 21:21:09.287 [DEBUG] [internal.client.HomeConnectApiClient] - [SIEMENS-SX878D16PE-xxxxxxxxxxxx] SSE KEEP-ALIVE

Same problem here.
The refresh token doesn’t seem to be working in the binding.
The only thing that got it working again, was generating a whole new token… but after 1h that’s expired too.

@yvesg @mstehle
Found the bug. It was my fault :frowning:
I saved the new refresh token in the configuration of the bridge item but not in the current instance of the API client --> The API client tried with the old refresh token. I just released a new version. Sorry.

I think it is not a coexistence that we all encounter the problems at the “same time”. Maybe a cleanup worker is removing the “old” refresh token. But we will never know.

Greetings,
JB

1 Like

Thank you Jonas for fixing this so quickly! I’ll install the new version right away.

Thank you for this binding, I have started using it for my Dishwasher.

Suggestion: My Siemens dishwasher has an internal light that can change color (through the Home Connect app), and I also have some LED strips in my kitchen. It would be cool if there was a channel in the binding so that the light color could be changed with OpenHAB.

Geir