almsh / homebridge-livolo-switches

12 stars 6 forks source link

Receiving error code 111: Nvalid username or password #13

Open alexey7 opened 2 years ago

alexey7 commented 2 years ago

Steps to reproduce:

  1. Register a new account in the LIVOLO app on the Europe server
  2. Link Livolo 2.0 Gateway and Zigbee switch to the LIVOLO app
  3. Install Homebridge Livolo Switches plugin using Homebridge Plugins page
  4. Open the plugin settings and insert credentials for the newly created Livolo account:

    {
    "platform": "livolo-switches",
    "name": "livolo-switches",
    "email": "my@mail.com",
    "password": "<myaccountpassword>" 
    }
    1. Restart the Homebridge

Actual result: An error received in logs: image

Expected result: The plugin should receive an access token and start working

Environment: homebridge v1.3.8 homebridge-config-ui-x v4.41.3 homebridge-livolo-switches v0.0.1-alpha.6

systemiii commented 2 years ago

Same issue

systemiii commented 2 years ago

Alexey, can you tell us in which way you have known the Livolo api login method, please? So we will try to fix it. Thank you

NinioDev commented 2 years ago

Hi, Same problem here, I tried both, using the plugin for homebridge, or download it locally to my PC and run it with node.js, here is the error I have on my PC:

LIVOLO Error
lib/livolo-api.js:86
/app/user/login
lib/livolo-api.js:87
{"data":null,"result_code":"111","result_msg":"Login failed"}
lib/livolo-api.js:88
can't get token data
lib/livolo-api.js:115
LIVOLO Error
lib/livolo-api.js:86
/app/user/login
lib/livolo-api.js:87
{"data":null,"result_code":"111","result_msg":"Nvalid username or password"}
lib/livolo-api.js:88
can't get token data
lib/livolo-api.js:115

when debugging, I have the error back on this function (in livolo-api.js):

LivoloApi.prototype._refreshToken = async function() {
  const verificationCode = await this._getVerificationCode();

  const saltedPasswordHash = crypto
    .createHash('md5')
    .update(this.passwordHash + verificationCode)
    .digest('hex');

  const tokenData = await this.apiRequester(`/app/user/login`, {
    method: 'POST',
    body: { user_name: this.login, password: saltedPasswordHash }
  });

@systemiii -> Can you please check it? appreciate it, Thank you.

systemiii commented 2 years ago

Yes, the error is raised by that function during authentication process. I think Livolo has changed the credentials checking algorithm, so we need to know the new one to fix It...

NinioDev commented 2 years ago

@almsh how can we check what is the new authentication method? Any idea how to bring back your plugin to work? I have added sniffer to my iPhone and the urls I have here are different then yours, it's secured urls:

eu-central-1.api-iot.aliyuncs.com:443

And

bot.livope.com:443

Any idea how we can fix it? I'll be happy to assist..

Thank you

systemiii commented 2 years ago

Urls sniffed by iPhone are dedicated to app connection, but the plug-in use Api server. I fear that now Livolo has started to use an ssl connection also for the api and in this case it will be impossible to fix, because we will never be able to have the required certificate.

NinioDev commented 2 years ago

got it, in this case, we will have to use zigbee2MQTT implementation, I saw many others succeeded connecting it using this implementation here: Livolo Zigbee using MQTT I'll give it a try.

Thanks for your answer @systemiii .

systemiii commented 2 years ago

I already tried Z2M before this plug-in and there are many issues with latest version of Livolo switches bought after july 2021. I warn you that you will not succeed in pairing them with standard Z2M (but i can give you the external converter i have written if you want) and after paired them, the lights will randomly turn on even at night and i couldn't figure out why. Switches bought before july seems not have these problems.

NinioDev commented 2 years ago

Thank you for your answer @systemiii . can you please tell me more about this external converter you have written? Maybe I'll try fixing it that way too in the meantime? maybe I'll figure out why the lights were randomly turned on? By the way, I've bought many switches from Livolo (around 25), and I'm chatting with their support from time to time, if you have a question I can forward them we can try it too.

systemiii commented 2 years ago

Send me your email address and I'll give you the external converter to use with the Z2M add-on for Home Assistant. In the Z2M documentation you will easily find how to use external converters. I have started reselling Livolo devices and I am also in constant contact with them, but I understand that they do not accept suggestions for improvement. In fact, they didn't use the standard Zigbee protocol and made a custom version of it ... and I don't know why!

NinioDev commented 2 years ago

Thank you @systemiii ! I'll try to test it by myself, is there any documentation for this converter? I know they did their implementation for the Zigbee connection, I read someone succeed in flashing it and made a regular Zigbee connection, I will try it too.

rhcpfan commented 2 years ago

Hello @NinioDev, @systemiii!

I've ran into the same issue with the new version of switches... Have you eventually succeeded in making it work?

ashantyk commented 1 month ago

any updates here ?