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.23k stars 2.49k forks source link

Integration can't start. #60

Closed finalbillybong closed 11 months ago

finalbillybong commented 11 months ago

Here are the logs.

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
Zaleo80 commented 11 months ago

This might be related (I changed some letters to X's and snipped some with ... in the Autorisation part of theURL's example below) Also started yesterday. (I think after the update to 2023.6.0)

Home Assistant 2023.6.0 Supervisor 2023.06.1 Operating System 10.2 Frontend-versie: 20230607.0 - latest

Haier hOn version 0.7.3 installed with HACS

2023-06-08 14:17:30.679 ERROR (MainThread) [pyhon.connection.auth] hOn Authentication Error
  1     401 - https://haiereurope.my.site.com/SmartHome/setup/secur/RemoteAccessAuthorizationPage.apexp?source=CAAAAYigFx6_MDAwMDAwXXXwXXXMDAwAAAA9Gv7n9TeWRBeBd_JbrZKxIoRjgJGyW54XkL35_RSrjHBD-hC9Z9G4-VbiYYxadU2xZJPqJZGIY_xC3hOsDcVff-jBSJ6zpjm-AfMWU1GF17kVawM3-xTNbT8Ur4g2OyDuxnGwqYaaOUg7A_ZXQWxf4YWVAdJCL6ThQQyUPuar2s6aCpXs24cs-c...hvP2dlz9KfFYydyVrpiZEJ4I60hWav8gTPJUT_AWQwUfBUMxBHcofUELZFt5jGB7sYehvOzGLjGKI8AbfkjF8NvpqWxxVuvor838uxlGEsPIwqYKEZ1fLe2Q1TM09CvKXS3Tto5BQKst5IjPEKnO3QBNZtrUV-VUwrFPWXdqGwPTkc2L1eW7Su-STfFyGE5szTDYE7RwvLYqvW6OlcUeGh9f_tXxXnwSmqz4oCDShr08j4aTAbHoav4KcetlzJ1RJdeUidFkrNdsIfdIcaBQWsrPM9DbwDtUzM5JxX5-HZHz2a-6tQPW2bEFAzhvOngkMd2c&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%3DCAAAAYigFx6_MDAwXXXAwMDAwXXXwAAAA9Gv7n9TeWRBeBd_JbrZKxIoRjgJGyW54XkL35_RSrjHBD-...STfFyGE5szTDYE7RwvLYqvW6OlcUeGh9f_tWtAnwSmqz4oCDShr08j4aTAbHoav4KcetlzJ1RJdeUidFkrNdsIfdIcaBQWsrPM9DbwDtUzM5JxX5-HZHz2a-6tQPW2bEFAzhvOngkMd2c%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%3DCAAAAYigFx6_MDAwMDAwXXXwMDAwXXXwAAAA9Gv7n9TeWRBeBd_JbrZKxIoRjgJGyW54XkL35_RSrjHBD-....2dGdZrsBE97_3h0Zm-iCmVGz6JlmW-9iOhwJCn8u2Xlk6eMh4i19hqXXXbzXXXXQQd7QiQwCDY0tE0I_qhvP2dlz9KfFYydyVrpiZEJ4I60hWav8gTPJUT_AWQwUfBUMxBHcofUELZFt5jGB7sYehvOzGLjGKI8AbfkjF8NvpqWxxVuvor838uxlGEsPIwqYKEZ1fLe2Q1TM09CvKXS3Tto5BQKst5IjPEKnO3QBNZtrUV-VUwrFPWXdqGwPTkc2L1eW7Su-STfFyGE5szTDYE7RwvLYqvW6OlcUeGh9f_tWtAnwSmqz4oCDShr08j4aTAbHoav4KcetlzJ1RJdeUidFkrNdsIfdIcaBQWsrPM9DbwDtUzM5JxX5-HZHz2a-6tQPW2bEFAzhvOngkMd2c%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%3DCAAAAYigFx6_XXXAwMDAwMDAwXXXwMDAwAAAA9Gv7n9TeWRBeBd_JbrZKxIoRjgJGyW54XkL35_RSrjHBD-hC9Z9X4-VbiYYxadU2xZJPqJZGIY_xC3hOsDcVff-jBSJ6zpjm-AfMWU1GF17kVawM3-xTNbT8Ur4g2OyDuxnGwqYaaOUg7A_ZXQWxf4YWVAdJCL6ThQQyUPuar2s6aCpXs24cs-...o5BQKst5IjPEKnO3QBNZtrUV-VUwrFPWXdqGwPTkc2L1eW7Su-STfFyGE5szTDYE7RwvLYqvW6OlcXeGh9f_tWtAnwSmqz4oCDShr08j4aTAbHoav4KcetlzJ1RJdeUidFkrNdsIfdIcaBQWsrPM9DbwDtUzM5JxX5-HZHz2a-6tQPW2bEFAzhvOngkMd2c%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-08 14:17:30.688 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry xxxxxx@gmail.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.11/site-packages/pyhon/hon.py", line 41, in create
    await self.setup()
  File "/usr/local/lib/python3.11/site-packages/pyhon/hon.py", line 63, in setup
    for appliance in (await self.api.load_appliances())["payload"]["appliances"]:
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/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.11/contextlib.py", line 204, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/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.11/contextlib.py", line 204, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/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.11/site-packages/pyhon/connection/handler/hon.py", line 49, in _check_headers
    await self.auth.authenticate()
  File "/usr/local/lib/python3.11/site-packages/pyhon/connection/auth.py", line 245, in authenticate
    if not (url := await self._login()):
                   ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyhon/connection/auth.py", line 182, in _login
    await self._error_logger(response)
  File "/usr/local/lib/python3.11/site-packages/pyhon/connection/auth.py", line 83, in _error_logger
    raise exceptions.HonAuthenticationError("Can't login")
pyhon.exceptions.HonAuthenticationError: Can't login
Zaleo80 commented 11 months ago

Guess it is related to the python 3.10 to 3.11 update in the 2023.6 release?

finalbillybong commented 11 months ago

I’m still on 2923.5.x so I don’t think so.

Zaleo80 commented 11 months ago

Guess it is not the main cause then

Before yesterday it worked perfectly. Started to notice some random issues after the update to 2023.6.

Some functions did not work (similar like other people also reported). Without checken here first I removed the integration fully and reinstalled it.

That basically braught me to this pickle.

Andre0512 commented 11 months ago

Hi, please checkout the latest beta version, should be fixed now

finalbillybong commented 11 months ago

I installed beta 10 and still get this 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.11/site-packages/pyhon/hon.py", line 61, in create
    await self.setup()
  File "/usr/local/lib/python3.11/site-packages/pyhon/hon.py", line 95, in setup
    await self._create_appliance(appliance)
  File "/usr/local/lib/python3.11/site-packages/pyhon/hon.py", line 77, in _create_appliance
    await asyncio.gather(
  File "/usr/local/lib/python3.11/site-packages/pyhon/appliance.py", line 218, in load_commands
    await self._add_favourites()
  File "/usr/local/lib/python3.11/site-packages/pyhon/appliance.py", line 235, in _add_favourites
    parameter.value = value
    ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/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
Andre0512 commented 11 months ago

Did you restart? In pyhOn v0.12.2 this line should look a bit different :thinking:

finalbillybong commented 11 months ago

Ive just done a second reboot and it seems to have loaded fine! Thanks for the fix!

Andre0512 commented 11 months ago

Nice! Thanks for reporting and testing :slightly_smiling_face:

Zaleo80 commented 11 months ago

Downloaded v0.8.0-beta.10 and put it in the config\custom_components\hon folder overwriting all duplicated files.

Reloaded HA, also I can confirm the issue is resolved. Highly appriciated.