Repository navigation
Description
Describe the bug
While Home Assistant was running, Wyze started rejecting the stored refresh token with code 2002 ("refresh token is error"). wyzeapy raises this as UnknownApiError, not AccessTokenError, so the integration never started reauth. Instead, every device's update loop in wyzeapy.services.update_manager called refresh_if_should() → refresh() again on its next cycle. That produced about 17,500 failed refresh attempts in 16 hours (roughly one every 3 seconds across all devices), and all Wyze entities stopped responding.
After a restart, the integration could not log in again with the saved username/password: auth-prod.api.wyze.com/api/user/login answered HTTP 429 for every login from our IP, including a test request with made-up credentials (X-RateLimit-Remaining: 0). api.wyzecam.com still answered normally. The block lifted by itself a few hours later. After that, setup with the saved credentials and API key worked straight away, so the API key had not been revoked.
PR #998 maps 2002 to ConfigEntryAuthFailed in async_setup_entry, which covers startup. It does not cover the case above, where the token goes bad while the integration is already running and the update loop keeps retrying it.
To Reproduce
- Integration is set up and running normally.
- Wyze invalidates the refresh token server-side (here at 01:25 local time, no action on our side).
- Every update cycle retries
refresh(), logsUnknownApiError: ('2002', 'refresh token is error'), and tries again on the next cycle. - After many hours, logins from the same IP get HTTP 429.
Expected behavior
On 2002 during a refresh, stop polling and start reauth once (as token_exception_handler already does for AccessTokenError/LoginError), instead of retrying indefinitely. It would also help to back off on repeated refresh failures, and to treat a 429 at login as "retry later" rather than a setup error.
System configuration
System: Docker (Home Assistant Container)
HA Version: 2026.11.1
WyzeApi Version: v0.1.41 (wyzeapy 0.8.1)
home-assistant.log
2026-11-25 01:25:56 ERROR (MainThread) [wyzeapy.services.update_manager] Unknown error happened during updating device info
Traceback (most recent call last):
File ".../wyzeapy/services/update_manager.py", line 59, in update
self.device = await self.service.update(self.device)
File ".../wyzeapy/services/camera_service.py", line 61, in update
response = await self._get_event_list(10)
File ".../wyzeapy/services/base_service.py", line 444, in _get_event_list
await self._auth_lib.refresh_if_should()
File ".../wyzeapy/wyze_auth_lib.py", line 357, in refresh_if_should
await self.refresh()
File ".../wyzeapy/wyze_auth_lib.py", line 387, in refresh
check_for_errors_standard(self, response_json)
File ".../wyzeapy/utils.py", line 143, in check_for_errors_standard
raise UnknownApiError(response_code, response_json["msg"])
wyzeapy.exceptions.UnknownApiError: ('2002', 'refresh token is error')
(repeated about 17,500 times until 17:19)
After restart with tokens cleared:
ERROR (MainThread) [homeassistant.config_entries] Error setting up entry for wyzeapi
aiohttp.client_exceptions.ContentTypeError: 429, message='Attempt to decode JSON with unexpected mimetype: ', url='https://auth-prod.api.wyze.com/api/user/login'
Activity
Benjin commentedon Nov 27, 2026
I'm also encountering this issue; looks like Wyzepy needs updating.
dozer8383 commentedon Nov 27, 2026
I started getting this issue when I updated to 2026.12.0b2, but I think it may have been coincidence, since the thermostat's status and sensors weren't updating at all yesterday.
CenterInYou commentedon Nov 29, 2026
I'm thinking it was coincidence. I'm still on 2026.11 and having the same issue.
locus123123 commentedon Nov 30, 2026
I'm getting very similar error on 2026.11 as well...
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1023, in __async_setup_with_context
setup_result: bool | None = await component.async_setup_entry(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
hass, self
^^^^^^^^^^
) # type: ignore[func-returns-value]
^
File "/config/custom_components/wyzeapi/init.py", line 122, in async_setup_entry
await client.login(
...<5 lines>...
)
File "/usr/local/lib/python3.14/site-packages/wyzeapy/init.py", line 112, in login
await self._auth_lib.refresh()
File "/usr/local/lib/python3.14/site-packages/wyzeapy/wyze_auth_lib.py", line 387, in refresh
check_for_errors_standard(self, response_json)
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/wyzeapy/utils.py", line 143, in check_for_errors_standard
raise UnknownApiError(response_code, response_json["msg"])
wyzeapy.exceptions.UnknownApiError: ('2002', 'refresh token is error')
gilbertth commentedon Nov 30, 2026
Same issue wyze integration not working anymore
mullethunter324 commentedon Dec 1, 2026
I am have the same issue, but my lighting automations are still working, just mainly the switches that aren't working for me.