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

[Bug] Integration cannot login to Wyze #498

Closed
ubergeek10 opened this issue Jul 29, 2023 · 5 comments
Closed

[Bug] Integration cannot login to Wyze #498

ubergeek10 opened this issue Jul 29, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@ubergeek10
Copy link

ubergeek10 commented Jul 29, 2023

Describe the bug
When installing the Wyze integration, my Wyze credentials are filled in via BitWarden (so I know they are correct) but the integrated throws an error. “Unknown error occurred.”

To Reproduce
Steps to reproduce the behavior:

  1. Click on add integration
  2. Enter username and password
  3. Press submit
  4. See error

Expected behavior
The integration should install.

System configuration
System: HASS
HA Version: 2023.7.3
WyzeApi Version: latest version

home-assistant.log


This error originated from a custom integration.

Logger: aiohttp.server
Source: custom_components/wyzeapi/config_flow.py:59 
Integration: Wyze Home Assistant Integration (documentation, issues) 
First occurred: 8:38:46 AM (1 occurrences) 
Last logged: 8:38:46 AM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 181, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 297, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 393, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/wyzeapi/config_flow.py", line 59, in async_step_user
    await self.client.login(
  File "/usr/local/lib/python3.11/site-packages/wyzeapy/__init__.py", line 81, in login
    await self._auth_lib.get_token_with_username_password(email, password)
  File "/usr/local/lib/python3.11/site-packages/wyzeapy/wyze_auth_lib.py", line 104, in get_token_with_username_password
    response_json = await self.post("https://auth-prod.api.wyze.com/user/login", headers=headers,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/wyzeapy/wyze_auth_lib.py", line 232, in post
    return await response.json()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1104, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://auth-prod.api.wyze.com/user/login')

@ubergeek10 ubergeek10 added the bug Something isn't working label Jul 29, 2023
@Evlmoonkey
Copy link

Evlmoonkey commented Jul 29, 2023

Same issue here, Token Error...

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 390, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/wyzeapi/init.py", line 121, in async_setup_entry
mac_addresses = await client.unique_device_ids
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/wyzeapy/init.py", line 138, in unique_device_ids
devices = await self._service.get_object_list()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/wyzeapy/services/base_service.py", line 122, in get_object_list
check_for_errors_standard(response_json)
File "/usr/local/lib/python3.11/site-packages/wyzeapy/utils.py", line 80, in check_for_errors_standard
raise AccessTokenError
wyzeapy.exceptions.AccessTokenError
2023-07-29 09:37:21.852 DEBUG (MainThread) [wyzeapy.wyze_auth_lib] Request:
2023-07-29 09:37:21.852 DEBUG (MainThread) [wyzeapy.wyze_auth_lib] url: https://api.wyzecam.com/app/v2/home_page/get_object_list
2023-07-29 09:37:21.852 DEBUG (MainThread) [wyzeapy.wyze_auth_lib] json: {'phone_system_type': '1', 'app_version': '2.18.43', 'app_ver': 'com.hualai.WyzeCam___2.18.43', 'sc': '9f275790cab94a72bd206c8876429f3c', 'ts': 1690641438, 'sv': '9d74946e652647e9b6c9d59326aef104', 'access_token': 'Sanitized', 'phone_id': '74d171c0-243c-423c-9747-1b545a9e375b', 'app_name': 'com.hualai.WyzeCam'}
2023-07-29 09:37:21.852 DEBUG (MainThread) [wyzeapy.wyze_auth_lib] headers: None
2023-07-29 09:37:21.852 DEBUG (MainThread) [wyzeapy.wyze_auth_lib] data: None
2023-07-29 09:37:21.852 DEBUG (MainThread) [wyzeapy.wyze_auth_lib] Response Json: {'ts': 1690641439902, 'code': '2001', 'msg': 'AccessTokenError', 'data': {}}
2023-07-29 09:37:21.874 ERROR (MainThread) [custom_components.wyzeapi.token_manager] TokenManager detected a login issue please re-login.
2023-07-29 09:37:21.899 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up wyzeapi platform for sensor
Traceback (most recent call last):
File "/config/custom_components/wyzeapi/token_manager.py", line 45, in inner_function
await func(*args, **kwargs)
File "/config/custom_components/wyzeapi/sensor.py", line 44, in async_setup_entry
locks = await lock_service.get_locks()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/wyzeapy/services/lock_service.py", line 34, in get_locks
self._devices = await self.get_object_list()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/wyzeapy/services/base_service.py", line 122, in get_object_list
check_for_errors_standard(response_json)
File "/usr/local/lib/python3.11/site-packages/wyzeapy/utils.py", line 80, in check_for_errors_standard
raise AccessTokenError
wyzeapy.exceptions.AccessTokenError

@NetDude12
Copy link

These are known issues and there appears to be some fixes on the way. Hope this helps
#493
#497
SecKatie/wyzeapy#70

@bfish2
Copy link

bfish2 commented Jul 31, 2023

I'm having same issue, too.

@James62370
Copy link

Same here... I was not able to login again without deleting the integration and re-adding After this I was prompted with a login option which included ID and API Key. After a successful login, you need to put your devices back in it's proper area. Automations still worked. Good luck everyone.

@ubergeek10
Copy link
Author

ubergeek10 commented Aug 3, 2023 via email

@SecKatie SecKatie closed this as completed Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants