Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration won’t log in since Hon updated their app #58

Closed
finalbillybong opened this issue Jun 3, 2023 · 27 comments
Closed

Integration won’t log in since Hon updated their app #58

finalbillybong opened this issue Jun 3, 2023 · 27 comments
Labels
authentication error Authentication Error bug Something isn't working pyhOn Issue in pyhOn

Comments

@finalbillybong
Copy link

No logs as I’m mobile right now. Will update when I get home. Just wanted to make you aware.

@finalbillybong finalbillybong changed the title Integration won’t long in since Hon updated their app Integration won’t log in since Hon updated their app Jun 3, 2023
@Andre0512
Copy link
Owner

Hi, I'm on vacation until the middle of next week and unfortunately I can't fix or even analyze it until then 😬
If someone finds the change in the api and can create a pr I can publish a new version.

@Andre0512
Copy link
Owner

Does this occur also on the latest stable version (v0.7.3)? For the beta version I set the hOn Version to 2.x in the const.py of pyhOn 🤔

@finalbillybong
Copy link
Author

finalbillybong commented Jun 3, 2023

Oh I wasn't busting' you balls for a fix. Just letting you know of the issue. Enjoy your holiday buddy!

I'm using v0.8.0-beta.5 so I can update to beta 8 and see what happens....

@finalbillybong
Copy link
Author

finalbillybong commented Jun 3, 2023

Logs:

This error originated from a custom integration.

Logger: pyhon.connection.auth
Source: custom_components/haier_hon/__init__.py:31 
Integration: haier_hon 
First occurred: 19:10:31 (1 occurrences) 
Last logged: 19:10:31

hOn Authentication Error 1 401 - https://haiereurope.my.site.com/SmartHome/setup/secur/RemoteAccessAuthorizationPage.apexp?source=CAAAAYiHmoJ2MDAwMDAwMDAwMDAwMDAwAAAA9HlRgWDILU4K_s5Hgv7J7llxCddBNdBJyoc6DF-VXzTNrMEaNT6UvQus2MaO4jsOqbNpHjSmdHWAQmYiQiGMcd3xD1wc0hchrxjXy9syUOijJTeW552pA4H7YbLDB6pb7JNrxZ2FXijPKyICCOdp_20nTrUIR3Zgj7c_8YiLvw2It75o9ZsSetgzie-DEY4ecpJQRxIqsT2mueYOPli8okzxus5CUZ1vcgYfkQNsccqRcEVqq7h9Eb6cfyQAfgrzBloTNidy-bwtD__X0erzbWFkTGIHmbjibUB2w3c5JhkBIsHa7DDHvPHzBFBHSb8B7ImTvoPrtqL9658h3_OQXQJykhroAJreotGvxiUPrsm_zbbZDOXuGwcjlN2_b0EBaXJdKjfAEfnyUz_-PlFQdnLVo7VU7Rr1ZEVmHYwdhSypClj8oBrL3gMpeWTBSA-3XQdbqHLA1fv2XDZef7wAfYg3VM14JdC2YoxkHzlW2nmGidgSO997-XDTIShZtNF7CDVmhXnqeyQ44oRe72HgjPgrDNc6VjYrX_9bbnnB_EZZW_NStlMeuGFlpqrxsJOnc_aD10yCLj_QnIpqoADOSonXs61ANwoXNdgZau2HWctX5LNU3JefUcUGjq93fZ-1H0F1B7mrXmZ3rkx4ss2OXqFNpoVyT6A4F4atDEpfOvkwQvt4B584eRMbIE9dZDvXPKvlzMNQgwkA-oZqff9pq5-sdtZTNNe38bJu8jH2Kvn7&display=touch 2 302 - https://haiereurope.my.site.com/SmartHome/s/login?display=touch&ec=302&inst=68&startURL=/SmartHome/setup/secur/RemoteAccessAuthorizationPage.apexp?source%3DCAAAAYiHmoJ2MDAwMDAwMDAwMDAwMDAwAAAA9HlRgWDILU4K_s5Hgv7J7llxCddBNdBJyoc6DF-VXzTNrMEaNT6UvQus2MaO4jsOqbNpHjSmdHWAQmYiQiGMcd3xD1wc0hchrxjXy9syUOijJTeW552pA4H7YbLDB6pb7JNrxZ2FXijPKyICCOdp_20nTrUIR3Zgj7c_8YiLvw2It75o9ZsSetgzie-DEY4ecpJQRxIqsT2mueYOPli8okzxus5CUZ1vcgYfkQNsccqRcEVqq7h9Eb6cfyQAfgrzBloTNidy-bwtD__X0erzbWFkTGIHmbjibUB2w3c5JhkBIsHa7DDHvPHzBFBHSb8B7ImTvoPrtqL9658h3_OQXQJykhroAJreotGvxiUPrsm_zbbZDOXuGwcjlN2_b0EBaXJdKjfAEfnyUz_-PlFQdnLVo7VU7Rr1ZEVmHYwdhSypClj8oBrL3gMpeWTBSA-3XQdbqHLA1fv2XDZef7wAfYg3VM14JdC2YoxkHzlW2nmGidgSO997-XDTIShZtNF7CDVmhXnqeyQ44oRe72HgjPgrDNc6VjYrX_9bbnnB_EZZW_NStlMeuGFlpqrxsJOnc_aD10yCLj_QnIpqoADOSonXs61ANwoXNdgZau2HWctX5LNU3JefUcUGjq93fZ-1H0F1B7mrXmZ3rkx4ss2OXqFNpoVyT6A4F4atDEpfOvkwQvt4B584eRMbIE9dZDvXPKvlzMNQgwkA-oZqff9pq5-sdtZTNNe38bJu8jH2Kvn7%26display%3Dtouch 3 301 - https://haiereurope.my.site.com/SmartHome/s/login/?display=touch&ec=302&inst=68&startURL=/SmartHome/setup/secur/RemoteAccessAuthorizationPage.apexp?source%3DCAAAAYiHmoJ2MDAwMDAwMDAwMDAwMDAwAAAA9HlRgWDILU4K_s5Hgv7J7llxCddBNdBJyoc6DF-VXzTNrMEaNT6UvQus2MaO4jsOqbNpHjSmdHWAQmYiQiGMcd3xD1wc0hchrxjXy9syUOijJTeW552pA4H7YbLDB6pb7JNrxZ2FXijPKyICCOdp_20nTrUIR3Zgj7c_8YiLvw2It75o9ZsSetgzie-DEY4ecpJQRxIqsT2mueYOPli8okzxus5CUZ1vcgYfkQNsccqRcEVqq7h9Eb6cfyQAfgrzBloTNidy-bwtD__X0erzbWFkTGIHmbjibUB2w3c5JhkBIsHa7DDHvPHzBFBHSb8B7ImTvoPrtqL9658h3_OQXQJykhroAJreotGvxiUPrsm_zbbZDOXuGwcjlN2_b0EBaXJdKjfAEfnyUz_-PlFQdnLVo7VU7Rr1ZEVmHYwdhSypClj8oBrL3gMpeWTBSA-3XQdbqHLA1fv2XDZef7wAfYg3VM14JdC2YoxkHzlW2nmGidgSO997-XDTIShZtNF7CDVmhXnqeyQ44oRe72HgjPgrDNc6VjYrX_9bbnnB_EZZW_NStlMeuGFlpqrxsJOnc_aD10yCLj_QnIpqoADOSonXs61ANwoXNdgZau2HWctX5LNU3JefUcUGjq93fZ-1H0F1B7mrXmZ3rkx4ss2OXqFNpoVyT6A4F4atDEpfOvkwQvt4B584eRMbIE9dZDvXPKvlzMNQgwkA-oZqff9pq5-sdtZTNNe38bJu8jH2Kvn7%26display%3Dtouch 4 200 - https://haiereurope.my.site.com/SmartHome/s/login/?language=en_US&display=touch&ec=302&inst=68&startURL=%2FSmartHome%2Fsetup%2Fsecur%2FRemoteAccessAuthorizationPage.apexp%3Fsource%3DCAAAAYiHmoJ2MDAwMDAwMDAwMDAwMDAwAAAA9HlRgWDILU4K_s5Hgv7J7llxCddBNdBJyoc6DF-VXzTNrMEaNT6UvQus2MaO4jsOqbNpHjSmdHWAQmYiQiGMcd3xD1wc0hchrxjXy9syUOijJTeW552pA4H7YbLDB6pb7JNrxZ2FXijPKyICCOdp_20nTrUIR3Zgj7c_8YiLvw2It75o9ZsSetgzie-DEY4ecpJQRxIqsT2mueYOPli8okzxus5CUZ1vcgYfkQNsccqRcEVqq7h9Eb6cfyQAfgrzBloTNidy-bwtD__X0erzbWFkTGIHmbjibUB2w3c5JhkBIsHa7DDHvPHzBFBHSb8B7ImTvoPrtqL9658h3_OQXQJykhroAJreotGvxiUPrsm_zbbZDOXuGwcjlN2_b0EBaXJdKjfAEfnyUz_-PlFQdnLVo7VU7Rr1ZEVmHYwdhSypClj8oBrL3gMpeWTBSA-3XQdbqHLA1fv2XDZef7wAfYg3VM14JdC2YoxkHzlW2nmGidgSO997-XDTIShZtNF7CDVmhXnqeyQ44oRe72HgjPgrDNc6VjYrX_9bbnnB_EZZW_NStlMeuGFlpqrxsJOnc_aD10yCLj_QnIpqoADOSonXs61ANwoXNdgZau2HWctX5LNU3JefUcUGjq93fZ-1H0F1B7mrXmZ3rkx4ss2OXqFNpoVyT6A4F4atDEpfOvkwQvt4B584eRMbIE9dZDvXPKvlzMNQgwkA-oZqff9pq5-sdtZTNNe38bJu8jH2Kvn7%26display%3Dtouch&System=IoT_Mobile_App&RegistrationSubChannel=hOn 5 200 - https://haiereurope.my.site.com/SmartHome/s/sfsites/aura?r=3&other.LightningLoginCustom.login=1 ERROR - 200 - https://haiereurope.my.site.com/SmartHome/s/sfsites/aura?r=3&other.LightningLoginCustom.login=1 =============== Response =============== */{"event":{"descriptor":"markup://aura:systemError","attributes":{"values":{"message":"[AuraClientInputException from server] Unexpected request input. Expected input format: \"Data in a request must be a valid JSON Object and must be in the expected format.\".","showOverride":false}},"eventDef":{"descriptor":"markup://aura:systemError","t":"APPLICATION","xs":"G","a":{"message":["message","aura://String","G",false],"error":["error","aura://String","G",false],"auraError":["auraError","aura://Object","I",false,null],"timestamp":["timestamp","aura://Integer","I",false],"showOverride":["showOverride","aura://Boolean","I",false,false]}}},"exceptionMessage":"[AuraClientInputException from server] Unexpected request input. Expected input format: \"Data in a request must be a valid JSON Object and must be in the expected format.\".","exceptionEvent":true}/*ERROR*/ ========================================
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/haier_hon/__init__.py", line 31, in async_setup_entry
    hon = await Hon(
  File "/usr/local/lib/python3.10/site-packages/pyhon/hon.py", line 61, in create
    await self.setup()
  File "/usr/local/lib/python3.10/site-packages/pyhon/hon.py", line 91, in setup
    for appliance in (await self.api.load_appliances())["payload"]["appliances"]:
  File "/usr/local/lib/python3.10/site-packages/pyhon/connection/api.py", line 69, in load_appliances
    async with self._hon.get(f"{const.API_URL}/commands/v1/appliance") as resp:
  File "/usr/local/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/usr/local/lib/python3.10/site-packages/pyhon/connection/handler/base.py", line 44, in get
    async with self._intercept(self._session.get, *args, **kwargs) as response:
  File "/usr/local/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/usr/local/lib/python3.10/site-packages/pyhon/connection/handler/hon.py", line 58, in _intercept
    kwargs["headers"] = await self._check_headers(kwargs.get("headers", {}))
  File "/usr/local/lib/python3.10/site-packages/pyhon/connection/handler/hon.py", line 49, in _check_headers
    await self.auth.authenticate()
  File "/usr/local/lib/python3.10/site-packages/pyhon/connection/auth.py", line 245, in authenticate
    if not (url := await self._login()):
  File "/usr/local/lib/python3.10/site-packages/pyhon/connection/auth.py", line 182, in _login
    await self._error_logger(response)
  File "/usr/local/lib/python3.10/site-packages/pyhon/connection/auth.py", line 83, in _error_logger
    raise exceptions.HonAuthenticationError("Can't login")
pyhon.exceptions.HonAuthenticationError: Can't login

@finalbillybong
Copy link
Author

Beta 8 has the same issue.

@rjosborne
Copy link

Does this occur also on the latest stable version (v0.7.3)? For the beta version I set the hOn Version to 2.x in the const.py of pyhOn 🤔

yes - same problem on v0.7.3 unfortunately.

@drudgebg
Copy link
Contributor

drudgebg commented Jun 4, 2023

Same problem with me.

@ndom91
Copy link

ndom91 commented Jun 4, 2023

Yeah seems to be a general change on their side, gvigroux's hOn integration (gvigroux/hon#94) suffers from the same issue.

Here's some more debugging logs:

2023-06-04 15:16:21.548 ERROR (MainThread) [pyhon.connection.auth] hOn Authentication Error
  1     401 - https://haiereurope.my.site.com/SmartHome/setup/secur/RemoteAccessAuthorizationPage.apexp?source=CAAAAYiLs5BEMDAwMDAwMDAwMDAwMDAwAAAA9HQtPm1pwOoHXi-51JY4ySBWs0g2Nd1Bf6C2_c1qcioLv0Qh7lSpqbAL_9enS1Hh-oBD1IQ5D6rVx01Dbb63pN_DBAXbge8DKSo6Kv-wFATjc-_ssDN3HVQe0lfWozHYPzKGpGCM5YZ6ITSijJmD-zAfwkKC3bcKxkIwMsZLZYBur48KnQzH8wSQT_LxLF1GovqSPnug1unynb5C5JWpdSaB_f6ty3gq4pyDYYK4YXdPLl9Uok32gxoU03U_Q98RIHLGytTOwwZyVXuwDufMiaJTR1lJVx1iNksmaZaCJ_EoLVknZK2oC0B0aXefgwL6L7h4ZXw1eVtjYYV4RkSHC89V8XLQXnBqZkaetjGNRt0V0NFtusbxinmZdSSV0rlGLAcfXbjZLuIL1kkFZ2uU1svsrPsAHF0rYQNDO9osGxHk3y4nj4sEBBYPWfy7kvXEjvtsLj5tjIb1N57a4L6t0fXHYgXWwKgAiCmputD8HsDxEBnLVDG5S3UvVko3tvjA-JqVFc2P4ARpswoTQsmNnBjLqc5Ijz6M0GMHIJddXN5jPOAE78wH_7T9KtfKPq2X5aPWs4dQKJZv_pMusPzwwkouC_gPggsOzGfZvMykFGZpM9wnp-JfnLoK3qkeu7aPXGhr0uvgkKjkCuR3h5R7QnDdg-4f_tsU3SfD9xB-OeefjTkto2dTNkmEGqcCvipEFbWuCogeBxvpSmC4Hc-Fv2RmmqltHoOIuZdSqo8BCvFk&display=touch
  2     302 - https://haiereurope.my.site.com/SmartHome/s/login?display=touch&ec=302&inst=68&startURL=/SmartHome/setup/secur/RemoteAccessAuthorizationPage.apexp?source%3DCAAAAYiLs5BEMDAwMDAwMDAwMDAwMDAwAAAA9HQtPm1pwOoHXi-51JY4ySBWs0g2Nd1Bf6C2_c1qcioLv0Qh7lSpqbAL_9enS1Hh-oBD1IQ5D6rVx01Dbb63pN_DBAXbge8DKSo6Kv-wFATjc-_ssDN3HVQe0lfWozHYPzKGpGCM5YZ6ITSijJmD-zAfwkKC3bcKxkIwMsZLZYBur48KnQzH8wSQT_LxLF1GovqSPnug1unynb5C5JWpdSaB_f6ty3gq4pyDYYK4YXdPLl9Uok32gxoU03U_Q98RIHLGytTOwwZyVXuwDufMiaJTR1lJVx1iNksmaZaCJ_EoLVknZK2oC0B0aXefgwL6L7h4ZXw1eVtjYYV4RkSHC89V8XLQXnBqZkaetjGNRt0V0NFtusbxinmZdSSV0rlGLAcfXbjZLuIL1kkFZ2uU1svsrPsAHF0rYQNDO9osGxHk3y4nj4sEBBYPWfy7kvXEjvtsLj5tjIb1N57a4L6t0fXHYgXWwKgAiCmputD8HsDxEBnLVDG5S3UvVko3tvjA-JqVFc2P4ARpswoTQsmNnBjLqc5Ijz6M0GMHIJddXN5jPOAE78wH_7T9KtfKPq2X5aPWs4dQKJZv_pMusPzwwkouC_gPggsOzGfZvMykFGZpM9wnp-JfnLoK3qkeu7aPXGhr0uvgkKjkCuR3h5R7QnDdg-4f_tsU3SfD9xB-OeefjTkto2dTNkmEGqcCvipEFbWuCogeBxvpSmC4Hc-Fv2RmmqltHoOIuZdSqo8BCvFk%26display%3Dtouch
  3     301 - https://haiereurope.my.site.com/SmartHome/s/login/?display=touch&ec=302&inst=68&startURL=/SmartHome/setup/secur/RemoteAccessAuthorizationPage.apexp?source%3DCAAAAYiLs5BEMDAwMDAwMDAwMDAwMDAwAAAA9HQtPm1pwOoHXi-51JY4ySBWs0g2Nd1Bf6C2_c1qcioLv0Qh7lSpqbAL_9enS1Hh-oBD1IQ5D6rVx01Dbb63pN_DBAXbge8DKSo6Kv-wFATjc-_ssDN3HVQe0lfWozHYPzKGpGCM5YZ6ITSijJmD-zAfwkKC3bcKxkIwMsZLZYBur48KnQzH8wSQT_LxLF1GovqSPnug1unynb5C5JWpdSaB_f6ty3gq4pyDYYK4YXdPLl9Uok32gxoU03U_Q98RIHLGytTOwwZyVXuwDufMiaJTR1lJVx1iNksmaZaCJ_EoLVknZK2oC0B0aXefgwL6L7h4ZXw1eVtjYYV4RkSHC89V8XLQXnBqZkaetjGNRt0V0NFtusbxinmZdSSV0rlGLAcfXbjZLuIL1kkFZ2uU1svsrPsAHF0rYQNDO9osGxHk3y4nj4sEBBYPWfy7kvXEjvtsLj5tjIb1N57a4L6t0fXHYgXWwKgAiCmputD8HsDxEBnLVDG5S3UvVko3tvjA-JqVFc2P4ARpswoTQsmNnBjLqc5Ijz6M0GMHIJddXN5jPOAE78wH_7T9KtfKPq2X5aPWs4dQKJZv_pMusPzwwkouC_gPggsOzGfZvMykFGZpM9wnp-JfnLoK3qkeu7aPXGhr0uvgkKjkCuR3h5R7QnDdg-4f_tsU3SfD9xB-OeefjTkto2dTNkmEGqcCvipEFbWuCogeBxvpSmC4Hc-Fv2RmmqltHoOIuZdSqo8BCvFk%26display%3Dtouch
  4     200 - https://haiereurope.my.site.com/SmartHome/s/login/?language=en_US&display=touch&ec=302&inst=68&startURL=%2FSmartHome%2Fsetup%2Fsecur%2FRemoteAccessAuthorizationPage.apexp%3Fsource%3DCAAAAYiLs5BEMDAwMDAwMDAwMDAwMDAwAAAA9HQtPm1pwOoHXi-51JY4ySBWs0g2Nd1Bf6C2_c1qcioLv0Qh7lSpqbAL_9enS1Hh-oBD1IQ5D6rVx01Dbb63pN_DBAXbge8DKSo6Kv-wFATjc-_ssDN3HVQe0lfWozHYPzKGpGCM5YZ6ITSijJmD-zAfwkKC3bcKxkIwMsZLZYBur48KnQzH8wSQT_LxLF1GovqSPnug1unynb5C5JWpdSaB_f6ty3gq4pyDYYK4YXdPLl9Uok32gxoU03U_Q98RIHLGytTOwwZyVXuwDufMiaJTR1lJVx1iNksmaZaCJ_EoLVknZK2oC0B0aXefgwL6L7h4ZXw1eVtjYYV4RkSHC89V8XLQXnBqZkaetjGNRt0V0NFtusbxinmZdSSV0rlGLAcfXbjZLuIL1kkFZ2uU1svsrPsAHF0rYQNDO9osGxHk3y4nj4sEBBYPWfy7kvXEjvtsLj5tjIb1N57a4L6t0fXHYgXWwKgAiCmputD8HsDxEBnLVDG5S3UvVko3tvjA-JqVFc2P4ARpswoTQsmNnBjLqc5Ijz6M0GMHIJddXN5jPOAE78wH_7T9KtfKPq2X5aPWs4dQKJZv_pMusPzwwkouC_gPggsOzGfZvMykFGZpM9wnp-JfnLoK3qkeu7aPXGhr0uvgkKjkCuR3h5R7QnDdg-4f_tsU3SfD9xB-OeefjTkto2dTNkmEGqcCvipEFbWuCogeBxvpSmC4Hc-Fv2RmmqltHoOIuZdSqo8BCvFk%26display%3Dtouch&System=IoT_Mobile_App&RegistrationSubChannel=hOn
  5     200 - https://haiereurope.my.site.com/SmartHome/s/sfsites/aura?r=3&other.LightningLoginCustom.login=1
ERROR - 200 - https://haiereurope.my.site.com/SmartHome/s/sfsites/aura?r=3&other.LightningLoginCustom.login=1
=============== Response ===============
*/{"event":{"descriptor":"markup://aura:systemError","attributes":{"values":{"message":"[AuraClientInputException from server] Unexpected request input. Expected input format: \"Data in a request must be a valid JSON Object and must be in the expected format.\".","showOverride":false}},"eventDef":{"descriptor":"markup://aura:systemError","t":"APPLICATION","xs":"G","a":{"message":["message","aura://String","G",false],"error":["error","aura://String","G",false],"auraError":["auraError","aura://Object","I",false,null],"timestamp":["timestamp","aura://Integer","I",false],"showOverride":["showOverride","aura://Boolean","I",false,false]}}},"exceptionMessage":"[AuraClientInputException from server] Unexpected request input. Expected input format: \"Data in a request must be a valid JSON Object and must be in the expected format.\".","exceptionEvent":true}/*ERROR*/
========================================
2023-06-04 15:16:21.552 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry user@domain.com for hon
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/hon/__init__.py", line 31, in async_setup_entry
    hon = await Hon(
  File "/usr/local/lib/python3.10/site-packages/pyhon/hon.py", line 41, in create
    await self.setup()
  File "/usr/local/lib/python3.10/site-packages/pyhon/hon.py", line 63, in setup
    for appliance in (await self.api.load_appliances())["payload"]["appliances"]:
  File "/usr/local/lib/python3.10/site-packages/pyhon/connection/api.py", line 69, in load_appliances
    async with self._hon.get(f"{const.API_URL}/commands/v1/appliance") as resp:
  File "/usr/local/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/usr/local/lib/python3.10/site-packages/pyhon/connection/handler/base.py", line 44, in get
    async with self._intercept(self._session.get, *args, **kwargs) as response:
  File "/usr/local/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/usr/local/lib/python3.10/site-packages/pyhon/connection/handler/hon.py", line 58, in _intercept
    kwargs["headers"] = await self._check_headers(kwargs.get("headers", {}))
  File "/usr/local/lib/python3.10/site-packages/pyhon/connection/handler/hon.py", line 49, in _check_headers
    await self.auth.authenticate()
  File "/usr/local/lib/python3.10/site-packages/pyhon/connection/auth.py", line 245, in authenticate
    if not (url := await self._login()):
  File "/usr/local/lib/python3.10/site-packages/pyhon/connection/auth.py", line 182, in _login
    await self._error_logger(response)
  File "/usr/local/lib/python3.10/site-packages/pyhon/connection/auth.py", line 83, in _error_logger
    raise exceptions.HonAuthenticationError("Can't login")
pyhon.exceptions.HonAuthenticationError: Can't login

@Andre0512
Copy link
Owner

I think every version is affected after a new login (if the token expired or restart happened).
The bug seems to be at this line in pyhOn. Until now the api expected not json data, but form data with values as json there. Maybe this changed now, maybe the encoding changed, maybe it's expected now a full json body. To find this out, it's necessary to see what the hOn app now sends to the servers with a mitm.
But I can not fix this myself until Wednesday...

@Cosik Cosik mentioned this issue Jun 5, 2023
@fishscrounger
Copy link

I think every version is affected after a new login (if the token expired or restart happened).

I think I was already having issues and then logged into the app on my phone to check. I'm not sure.

I am currently decompiling the hOn app. I will let you know if I find anything.

@fishscrounger
Copy link

https://github.com/banto6/haier/blob/master/custom_components/haier/haier.py

This seems to be the new way of authenticating.

@Andre0512
Copy link
Owner

This seems to be for Haier uhome (haier app for chinese market) only 🤔
Haier has a lot of apps for different markets, see this comment.
Some share the same authentication and some use a complety different.

@fishscrounger
Copy link

Oh, shame. I thought I was on to something there. I'm glad I didn't go into too much detail. Thanks for the heads up!

@Andre0512
Copy link
Owner

Hey, I'm back in Germany and had a quick look and think I found the issue. It seems there was really a change in the json quoting of the form and I fixed this now in pyhOn.
I created a new beta release v0.8.0-beta.9. Please test and if this works for everyone, I will publish the new v0.8.0 soon.

@Andre0512 Andre0512 added bug Something isn't working authentication error Authentication Error pyhOn Issue in pyhOn labels Jun 7, 2023
@pawel-bujak
Copy link

Hi, it's working, I've just login successfully.

@rjosborne
Copy link

works fine for me too - thanks.

@fishscrounger
Copy link

Who gets home and then immediately fixes it in the early hours of the morning?!

But great job, thanks!

@finalbillybong
Copy link
Author

Still not working for me.

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/haier_hon/__init__.py", line 31, in async_setup_entry
    hon = await Hon(
  File "/usr/local/lib/python3.10/site-packages/pyhon/hon.py", line 61, in create
    await self.setup()
  File "/usr/local/lib/python3.10/site-packages/pyhon/hon.py", line 95, in setup
    await self._create_appliance(appliance)
  File "/usr/local/lib/python3.10/site-packages/pyhon/hon.py", line 77, in _create_appliance
    await asyncio.gather(
  File "/usr/local/lib/python3.10/site-packages/pyhon/appliance.py", line 218, in load_commands
    await self._add_favourites()
  File "/usr/local/lib/python3.10/site-packages/pyhon/appliance.py", line 235, in _add_favourites
    parameter.value = value
  File "/usr/local/lib/python3.10/site-packages/pyhon/parameter/range.py", line 58, in value
    if self._min <= value <= self._max and not (value - self._min) % self._step:
ZeroDivisionError: float modulo

@Maicolsara
Copy link

Maicolsara commented Jun 7, 2023

Ehi, sono tornato in Germania e ho dato una rapida occhiata e penso di aver trovato il problema. Sembra che ci sia stato davvero un cambiamento nella citazione json del modulo e l'ho risolto ora in pyhOn . Ho creato una nuova versione beta v0.8.0-beta.9. Per favore prova e se funziona per tutti, pubblicherò v0.8.0presto il nuovo.

Ciao l'integrazione adesso effettua la registrazione, il problema che non capisco è quando vado ad accendere il climatizzatore dopo qualche secondo torna automaticamente su spento

@Andre0512
Copy link
Owner

Andre0512 commented Jun 7, 2023

@finalbillybong that's seems to be another issue that is not related to the authentication, please create a new GitHub issue 🙂

@Andre0512
Copy link
Owner

@Maicolsara I don't understand, please write in English (check if you have an auto translation enabled)

@Maicolsara
Copy link

@Andre0512 sorry, Hi the integration now registers, the problem is not when I go to turn on the air conditioner after a few seconds it automatically goes back to off

@Andre0512
Copy link
Owner

Could be the same behavior like #52 (I will be working on it in the next days), please check it out or create a new issue if it's another problem.

@ndom91
Copy link

ndom91 commented Jun 7, 2023

I'm still seeing 0.7.3 as the latest version available via HACS. Anyone else?

@Andre0512
Copy link
Owner

Andre0512 commented Jun 7, 2023

I'm still seeing 0.7.3 as the latest version available via HACS. Anyone else?

So far I just release a new beta, you can install it like this

  1. Click redownload
    Screenshot from 2023-06-07 21-19-02
  2. Enable beta versions
    Screenshot from 2023-06-07 21-19-19
  3. Choose latest beta version and click download

But I will release v0.8.0 soon 🙂

@wesley2004
Copy link

I seems to work. Only thing…cool and heat not working. Other functions are working

@ndom91
Copy link

ndom91 commented Jun 8, 2023

Ah didn't see that it was only released as a beta. Thanks for clarification, works again!

@Andre0512 Andre0512 mentioned this issue Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
authentication error Authentication Error bug Something isn't working pyhOn Issue in pyhOn
Projects
None yet
Development

No branches or pull requests

9 participants