RMCob / homebridge-wyze-robovac

This plug-in provides rudimentary control for a Wyze Robot Vacuum.
Apache License 2.0
8 stars 4 forks source link

Plugin is generating HTTP 400's when hitting https://auth-prod.api.wyze.com/user/login #15

Closed asachs01 closed 1 year ago

asachs01 commented 1 year ago

Describe The Bug:

It appears that the plugin is hitting a non-existent endpoint:

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://auth-prod.api.wyze.com/user/login

CleanShot 2023-04-18 at 16 51 12

Expected behavior:

The error shouldn't be produced?

Logs:

[4/18/2023, 8:50:32 PM] [WyzeRoboVac] error: Command failed: python3 /usr/lib/node_modules/homebridge-wyze-robovac/py_helpers/getVacuumDeviceList.py XXXXXXXXXXXXX
Traceback (most recent call last):
  File "/usr/lib/node_modules/homebridge-wyze-robovac/py_helpers/getVacuumDeviceList.py", line 13, in <module>
    client = Client(email=sys.argv[1], password=os.sys.argv[2])
  File "/usr/local/lib/python3.10/dist-packages/wyze_sdk/api/client.py", line 66, in __init__
    self.login()
  File "/usr/local/lib/python3.10/dist-packages/wyze_sdk/api/client.py", line 164, in login
    response = self._auth_client().user_login(email=self._email, password=self._password, totp_key=self._totp_key)
  File "/usr/local/lib/python3.10/dist-packages/wyze_sdk/service/auth_service.py", line 75, in user_login
    response = self.api_call('/user/login', json=kwargs, nonce=nonce)
  File "/usr/local/lib/python3.10/dist-packages/wyze_sdk/service/auth_service.py", line 56, in api_call
    return super().api_call(
  File "/usr/local/lib/python3.10/dist-packages/wyze_sdk/service/base.py", line 347, in api_call
    return super().api_call(
  File "/usr/local/lib/python3.10/dist-packages/wyze_sdk/service/base.py", line 204, in api_call
    return self.do_post(url=api_url, headers=headers, payload=json, params=params)
  File "/usr/local/lib/python3.10/dist-packages/wyze_sdk/service/base.py", line 132, in do_post
    return self._do_request(client, req)
  File "/usr/local/lib/python3.10/dist-packages/wyze_sdk/service/base.py", line 106, in _do_request
    raise err
  File "/usr/local/lib/python3.10/dist-packages/wyze_sdk/service/base.py", line 93, in _do_request
    response.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://auth-prod.api.wyze.com/user/login

Plugin Config:

        {
            "name": "WyzeRoboVac",
            "username": "XXXXXXXX",
            "password": "XXXXXXXX",
            "mfaCode": "XXXXXXXX",
            "statusCheckRefreshInterval": 30,
            "idleBatteryCheckRefreshInterval": 1800,
            "busyBatteryCheckRefreshInterval": 120,
            "path2py_stubs": "/usr/lib/node_modules/homebridge-wyze-robovac/py_helpers",
            "debugLevel": 1,
            "platform": "WyzeRoboVac"
        },

Environment:

RMCob commented 1 year ago

@asachs01 First of all you should not post logs that contain your login credentials. Secondly, this problem is not repeatable on my RPi 4 system running Raspbian Linux. In the Caveats section of the READ_ME I mention that I cannot support or investigate issues where the environment is different from mine. If your login credentials were correct this should work.

asachs01 commented 1 year ago

Thanks for your feedback @RMCob, though candidly, it comes across as a scolding/finger wagging. Sure, I get it, I goofed. I'll make a note for the future.