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.21k stars 2.51k forks source link

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

Closed finalbillybong closed 10 months ago

finalbillybong commented 10 months ago

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

Andre0512 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

Beta 8 has the same issue.

rjosborne commented 10 months ago

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 commented 10 months ago

Same problem with me.

ndom91 commented 10 months ago

Yeah seems to be a general change on their side, gvigroux's hOn integration (https://github.com/gvigroux/hon/issues/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 commented 10 months ago

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...

fishscrounger commented 10 months ago

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 commented 10 months ago

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

This seems to be the new way of authenticating.

Andre0512 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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.

pawel-bujak commented 10 months ago

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

rjosborne commented 10 months ago

works fine for me too - thanks.

fishscrounger commented 10 months ago

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

But great job, thanks!

finalbillybong commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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

Andre0512 commented 10 months ago

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

Maicolsara commented 10 months ago

@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 commented 10 months ago

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 commented 10 months ago

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

Andre0512 commented 10 months ago

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 :slightly_smiling_face:

wesley2004 commented 10 months ago

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

ndom91 commented 10 months ago

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