romedtino / simple-wyze-vac

Home Assistant Custom Component for Wyze Vacuum
48 stars 8 forks source link

Integration "Failed to Setup" #61

Closed Jizzay1 closed 1 year ago

Jizzay1 commented 1 year ago

Long time working integration through HACS (thank you thank you thank you!). As of this past week I get a "failed to setup" error under Devices and a "check the logs" link which has the following error.

Wyze Vacuum Firmware: 1.6.202

This error originated from a custom integration.

Logger: homeassistant.config_entries Source: custom_components/simple_wyze_vac/init.py:48 Integration: Simple Wyze Vac (documentation) First occurred: 1:09:34 PM (1 occurrences) Last logged: 1:09:34 PM

Error setting up entry Simple Wyze Vac for simple_wyze_vac 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/simple_wyze_vac/init.py", line 48, in async_setup_entry client = await hass.async_add_executor_job(Client, None, None, username, password, totp) File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.10/site-packages/wyze_sdk/api/client.py", line 66, in init self.login() File "/usr/local/lib/python3.10/site-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/site-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/site-packages/wyze_sdk/service/auth_service.py", line 56, in api_call return super().api_call( File "/usr/local/lib/python3.10/site-packages/wyze_sdk/service/base.py", line 347, in api_call return super().api_call( File "/usr/local/lib/python3.10/site-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/site-packages/wyze_sdk/service/base.py", line 132, in do_post return self._do_request(client, req) File "/usr/local/lib/python3.10/site-packages/wyze_sdk/service/base.py", line 106, in _do_request raise err File "/usr/local/lib/python3.10/site-packages/wyze_sdk/service/base.py", line 93, in _do_request response.raise_for_status() File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 1021, 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

romedtino commented 1 year ago

Hm seems like it failed to login. Were you using 2FA? Does restarting the component help? Does restarting HA help? How about removing the custom component, restart HA, Reinstall simple wyze vac? Any changes to account such as password change or removal/adding of 2FA?

The error essentially happens exactly after attempting to login Wyze servers so it might require some debugging your user account such as logging out of Wyze app on your phone and relogging in and seeing if it works. Then try the same by doing the uinstall/restart HA/install of Simple Wyze Vac.

Jizzay1 commented 1 year ago

Thank you for taking the time to response. This fixed the issue:

Remove Integration (keep HACS installation) Restart HA Re-Install Integration and log in

All good now.