Andre0512 / hon

Home Assistant integration for Haier hOn: support for Haier/Candy/Hoover home appliances like washing machines and air conditioners in 28 languages.
MIT License
1.3k stars 2.46k forks source link

Can not login with correct email and password #215

Open maxifly opened 5 months ago

maxifly commented 5 months ago

v0.13.0

I use EVO application on my phone.| I setup addon to HA, enter correct email and password (I check this information by logout/login on phone) In HA log I see that hon can not login In integration setting I see my email "Setup fail" and "No device or entityes".

Environment (please complete the following information):

Additional context Add any other context about the problem here.

Home Assistant Logs Check System -> Logs if you can find any logs related to this integration and post it here.

Device Log Post your device info here (if available) 2024-06-01 17:10:34.864 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry maxxxx@mail.ru for hon Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 575, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/hon/init.py", line 41, in async_setup_entry hon = await Hon(*kwargs).create() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyhon/hon.py", line 74, in create await self.setup() File "/usr/local/lib/python3.12/site-packages/pyhon/hon.py", line 105, in setup appliances = await self.api.load_appliances() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyhon/connection/api.py", line 84, in load_appliances async with self._hon.get(f"{const.API_URL}/commands/v1/appliance") as resp: File "/usr/local/lib/python3.12/contextlib.py", line 210, in aenter return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyhon/connection/handler/base.py", line 64, in get async with self._intercept(args, **kwargs) as response: File "/usr/local/lib/python3.12/contextlib.py", line 210, in aenter return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyhon/connection/handler/hon.py", line 74, in _intercept kwargs["headers"] = await self._check_headers(kwargs.get("headers", {})) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyhon/connection/handler/hon.py", line 64, in _check_headers await self.auth.authenticate() File "/usr/local/lib/python3.12/site-packages/pyhon/connection/auth.py", line 258, in authenticate if not (url := await self._login()): ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyhon/connection/auth.py", line 195, in _login await self._error_logger(response) File "/usr/local/lib/python3.12/site-packages/pyhon/connection/auth.py", line 96, in _error_logger raise exceptions.HonAuthenticationError("Can't login") pyhon.exceptions.HonAuthenticationError: Can't login

tomaszwozniak commented 5 months ago
  1. Reset password in you hon app
  2. Remove integration entry in haier h0n integration
  3. Add again
Feirbran commented 5 months ago

Hello there, I'm having the same issue and I also tried what @tomaszwozniak suggested but gives me the same error. My Logs: Dettagli registro (ERRORE) Registratore: homeassistant.config_entries Fonte: config_entries.py:594 Prima occorrenza: 12:39:22 (7 occorrenze) Ultima registrazione: 12:46:00

Error setting up entry fxxxxxxxxxxxx@gmail.com for hon Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/hon/init.py", line 41, in async_setup_entry hon = await Hon(*kwargs).create() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyhon/hon.py", line 74, in create await self.setup() File "/usr/local/lib/python3.12/site-packages/pyhon/hon.py", line 105, in setup appliances = await self.api.load_appliances() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyhon/connection/api.py", line 84, in load_appliances async with self._hon.get(f"{const.API_URL}/commands/v1/appliance") as resp: File "/usr/local/lib/python3.12/contextlib.py", line 210, in aenter return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyhon/connection/handler/base.py", line 64, in get async with self._intercept(args, **kwargs) as response: File "/usr/local/lib/python3.12/contextlib.py", line 210, in aenter return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyhon/connection/handler/hon.py", line 74, in _intercept kwargs["headers"] = await self._check_headers(kwargs.get("headers", {})) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyhon/connection/handler/hon.py", line 64, in _check_headers await self.auth.authenticate() File "/usr/local/lib/python3.12/site-packages/pyhon/connection/auth.py", line 258, in authenticate if not (url := await self._login()): ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyhon/connection/auth.py", line 195, in _login await self._error_logger(response) File "/usr/local/lib/python3.12/site-packages/pyhon/connection/auth.py", line 96, in _error_logger raise exceptions.HonAuthenticationError("Can't login") pyhon.exceptions.HonAuthenticationError: Can't login

ikreis commented 5 months ago
  1. Reset password in you hon app
  2. Remove integration entry in haier h0n integration
  3. Add again

This fixed it for me. Seems so easy in the end, but was reluctant to choose "delete".

mateuszfl commented 5 months ago

Yes, I had exactly the same problem today, but before deleting it (because I had similar concerns) I tried to persistently add the integration again, it ended with an empty window without any message. It wasn't until I looked at the server's response that I saw the actual error information (duplicate).

Also, remove and re-add according to the instructions.

daemon76 commented 5 months ago

Log in to the website https://account2.hon-smarthome.com using your login and password and turn off Two-Factor Verification in your account settings. It worked for me.

mschmiedel commented 5 months ago

Hmmm, I don't get it, I tried what is suggested here:

  1. Delete Integration
  2. Reset pwd
  3. Login as @daemon76 suggested and make sure 2FA is deactivated
  4. Readd Integration

I am stuck with the "Can't login" message posted by @Feirbran.

Maybe one thought, we had our account configured with Google Social Login, I reset the pwd today for the first time in like a year to get the integration to work. Might there be a difference on accounts that support social login? Could other people who have posted and cannot fix this confirm if this is the case on their account too?

daemon76 commented 5 months ago

I did not use a social account, but it is possible that a social account is handled differently.

pt., 28 cze 2024 o 18:13 mschmiedel @.***> napisał(a):

Hmmm, I don't get it, I tried what is suggested here:

  1. Delete Integration
  2. Reset pwd
  3. Login as @daemon76 https://github.com/daemon76 suggested and make sure 2FA is deactivated
  4. Readd Integration

I am stuck with the "Can't login" message posted by @Feirbran https://github.com/Feirbran.

Maybe one thought, we had our account configured with Google Social Login, I reset the pwd today for the first time in like a year to get the integration to work. Might there be a difference on accounts that support social login? Could other people who have posted and cannot fix this confirm if this is the case on their account too?

— Reply to this email directly, view it on GitHub https://github.com/Andre0512/hon/issues/215#issuecomment-2197250986, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANSG6LRKK6PBQVUEVIUIOI3ZJWDR7AVCNFSM6AAAAABIUGJELWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJXGI2TAOJYGY . You are receiving this because you were mentioned.Message ID: @.***>

mschmiedel commented 5 months ago

@daemon76 , just to make it clear, I do not use the social login for the integration (this cannot work!), just created a pwd which I can use on the app and on the account2.hon-smarthome.com by hand, but not on the integration.

I just checked the pyhOn library:

Exception is raising here:

image

Last thing it prints is this: homeassistant | 1 200 - https://account2.hon-smarthome.com/setup/secur/RemoteAccessAuthorizationPage.apexp?source

along with the full response body of that page, which has a few js if conditions for some redirect, but if I understand the code correctly from the auth.py, it seems to be looking for some "url=" regex or the access token, which it cannot find...

Redirects want to go to https://account2.hon-smarthome.com/loginflow/loginFlowOnly.apexp?retURL=...

However, these are js manual redirects, not http (30X) ones...

What is very strange, if I do the login in a browser, I never see the "RemoteAccessAuthorizationPage" in the log...

Maybe a feedback for @Andre0512: I activated debug in the HomaAssistant Integration, for the auth flow, it would be great if in that case every visited URL with response codes would be logged.

mschmiedel commented 5 months ago

One more comment here. I checked out the phyOn library and made a manual test from my pc. I can successfully login outside of HomeAssistant using the library. So I guess it might be some difference with the aiohttp HomeAssistant provides (maybe not in every case). I will see if I find a way to log stuff like the user-agent headers (in case they are set) and such...

mschmiedel commented 5 months ago

This is very strange, I just retested (without deleting and adding the integration) and it worked, maybe it was just a coincidence that something was wrong on server-side and I tested the lib manually after the fix. Now it works and I got the entities...

Triskae commented 4 months ago

Same problem here ... Can't login, tried to change the password, tried to delete and install the integration again, nothing works ... 😢 Edit: Also tried with pyH0n and have a similar problem.

But it's strange since, I don't have an HTTP error, instead it seems to get a 200, but for some reason, it's considered as an error

image

lacko-hub commented 4 months ago

Same login issue here. Credentials are good as they works in mobile app or via http page. PWD reset, integration re-download did not help :/

Logger: pyhon.connection.auth Zdroj: custom_components/hon/init.py:40 Integrácia: Haier hOn (dokumentácia, problémy) Prvýkrát sa vyskytol: 15:00:32 (1 výskytov) Naposledy prihlásený: 15:00:32

hOn Authentication Error 1 200 -

dszymczuk commented 4 months ago

I have some error since 1st of July. I've reset password, uninstall and install again integration. Still pyhon.exceptions.HonAuthenticationError: Can't login.

On mobile app works fine.

mschmiedel commented 4 months ago

Could it be that freshly changed passwords are not synced and might need some time? In my case it startet working when I ignored it for like 24h... ;) I guess the login flow that was reverse engineered in the pyHOn library might not be always 100% identical to what happens in the app. At the end it is not an official integration. ;)

Rafapadilla93 commented 4 months ago

I have the same problem. I changed the password and then I looged into https://account2.hon-smarthome.com/ as @daemon76 suggested. It didn't work.

Does somebody know how to solve it?

Thank you so much!

iancedev commented 4 months ago

Same login issue here. The only thing I did different I think is that I had first created my hon account with Google sign-in, but as I noticed I needed a password to login I've reset password. Still, can't login.

Rafapadilla93 commented 4 months ago

It seems that the solution is here #230 @addshore has made a fork with corrections https://github.com/addshore/hon

(It doesn't work for me)

Triskae commented 4 months ago

It seems that the solution is here #230 @addshore has made a fork with corrections https://github.com/addshore/hon

(It doesn't work for me)

It doesn't work for me neither :/

goktugolmez commented 3 months ago

I have same issue is there any update for this. I tested every method.