bwp91 / homebridge-ewelink

Homebridge plugin to integrate eWeLink devices into HomeKit.
MIT License
384 stars 127 forks source link

auto reconnection after using creditiales on other device #400

Closed JacekKac closed 1 year ago

JacekKac commented 1 year ago

What issue do you have? Please be as thorough and explicit as possible.

homebridge-ewlink is not properly reconnecting to ewlink cloud after using account on other devices/instances. Steps:

1/ hb-ewlink connected properly 2/ loging to ewlink account on mobile phone 3/ hb-ewlink gives WS 406 Error and trying to reconnect 4/ Login out of the app 5/ hb-ewlink still gives WS 406 6/ restarting hb solves the issue

Imho it should reconnect without restarting whole HB, and it should be done automaticly


WS 406 Error
12.08.2022, 10:35:47] [eWeLink] WS login failed [406] see http://bit.ly/hb-ewelink-errors
[12.08.2022, 10:35:47] [eWeLink] WS unknown command received.
{
  "error": 406,
  "apikey": "xxxxxxxxxxxxxxxxxxxxxxxx",
  "sequence": "1660293347288",
  "actionName": "userOnline",
  "params": {}
}
[12.08.2022, 10:35:47] [eWeLink] WS error event and will try to reconnect in 5 seconds [1000].

```### Details of your setup.
standard homebridge stable - 
bwp91 commented 1 year ago

Hi @JacekKac

You need to use a separate ewelink account now. Create a second ewelink account, share your devices to this account, but use your main ewelink account for the plugin and keep logged into the ewelink app with the second account

JacekKac commented 1 year ago

@bwp91 thank you, seems like good idea, but still is it not a bug that hb-ewlink is to able relogin sucesfully and restart is nesesery ?

MoTechnicalities commented 1 year ago

@JacekKac It's not a HB-EWeLINK bug.

The EWeLINK platform no longer allows multi device logins as part of their policy. It however does allow sharing an account with other users.

Therefore, the best solution available is to make User-EWeLINK accounts for each of the users and a HB-EWeLINK account that you share to your users needing device access through the platform.

There is no way around it. If you log into the HB-EWeLINK account from a phone or other device then you must restart Homebridge for the plugin to reconnect to that account again. EWeLINK will then disconnect you phone App if logged in to the HB-EWeLINK account.

MoTechnicalities commented 1 year ago

@JacekKac There is also no way for the plugin to first check if other users are logged out before attempting to log back in. So any auto reconnect would consistently knock your Phone App off if you were really trying to log into that account from it.

JacekKac commented 1 year ago

Seems like a dead end to me, I think good solution will be to add a option "force login" instead of manuall restart, maybe with some time setting.

MoTechnicalities commented 1 year ago

add a option "force login" ... with some time setting.

I like that too.

bwp91 commented 1 year ago

Hi, Closing this just as been a little overwhelmed with issues recently. If this is still an issue or a feature you would like implemented then please do re-open this ticket! Thanks for your understanding!