SecKatie / ha-wyzeapi

Home Assistant Integration for Wyze devices.
733 stars 112 forks source link

[Bug] Failed to connect to Wyze service #94

Closed davidlang42 closed 3 years ago

davidlang42 commented 3 years ago

Wyze sensors stopped updating in the last 2-3 days, now on restart the service fails to set up with the message "Failed to connect to Wyze Service"

Logger: homeassistant.components.light Source: custom_components/wyzeapi/wyzeapi/client.py:78 Integration: Light (documentation, issues) First occurred: 22:10:49 (1 occurrences) Last logged: 22:10:49

Error while setting up wyzeapi platform for light Traceback (most recent call last): File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity_platform.py", line 193, in _async_setup_platform await asyncio.shield(task) File "/home/homeassistant/homeassistant/custom_components/wyzeapi/light.py", line 37, in async_setup_platform bulbs = await wyzeapi_client.list_bulbs() File "/home/homeassistant/homeassistant/custom_components/wyzeapi/wyzeapi/client.py", line 314, in list_bulbs await self.get_devices() File "/home/homeassistant/homeassistant/custom_components/wyzeapi/wyzeapi/client.py", line 274, in get_devices response_json = await self.__post_and_recover(WyzeApiConstants.get_devices_url, payload) File "/home/homeassistant/homeassistant/custom_components/wyzeapi/wyzeapi/client.py", line 78, in __post_and_recover raise ConnectionError("Failed to connect to the Wyze Service") ConnectionError: Failed to connect to the Wyze Service

System configuration System: HomeAssistant Core in FreeBSD jail HA Version: 0.116.4 WyzeApi Version: 0.5.12

Log 2020-11-06 22:10:43 DEBUG (MainThread) [custom_components.wyzeapi]

Wyze Bulb and Switch Home Assistant Integration

Version: v0.5.12 This is a custom integration If you have any issues with this you need to open an issue here: https://github.com/JoshuaMulliken/ha-wyzeapi/issues

2020-11-06 22:10:43 DEBUG (MainThread) [custom_components.wyzeapi] Creating new WyzeApi component 2020-11-06 22:10:43 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Running login 2020-11-06 22:10:43 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Running create_md5_md5 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi] Connected to Wyze account 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi] Starting WyzeApi components 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi] Starting WyzeApi Lights 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi] Starting WyzeApi switches 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi] Starting WyzeApi Sensors 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi] Starting WyzeApi lock 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi.light] Creating new WyzeApi light component 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Running list_bulbs 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Running get_devices 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi.switch] Creating new WyzeApi switch component 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Running list_switches 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Running get_devices 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi.binary_sensor] Creating new WyzeApi binary_sensor component 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Running list_contact_sensors 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Running get_devices 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi.lock] Creating new WyzeApi Lock component 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Running list_locks 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Running get_devices 2020-11-06 22:10:49 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Request to: https://api.wyzecam.com/app/v2/home_page/get_object_list failed with payload: {'phone_id': 'REDACTED', 'app_name': 'com.hualai.WyzeCam', 'app_version': '2.6.62', 'sc': '9f275790cab94a72bd206c8876429f3c', 'sv': '41267de22d1847c8b99bfba2658f88d7', 'phone_system_type': '1', 'appver': 'com.hualai.WyzeCam2.6.62', 'ts': '1604661049', 'access_token': 'REDACTED'} with result of {'ts': 1604661049828, 'code': '1006', 'msg': '', 'data': {}} 2020-11-06 22:10:49 ERROR (MainThread) [homeassistant.components.light] Error while setting up wyzeapi platform for light Traceback (most recent call last): File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity_platform.py", line 193, in _async_setup_platform await asyncio.shield(task) File "/home/homeassistant/homeassistant/custom_components/wyzeapi/light.py", line 37, in async_setup_platform bulbs = await wyzeapi_client.list_bulbs() File "/home/homeassistant/homeassistant/custom_components/wyzeapi/wyzeapi/client.py", line 314, in list_bulbs await self.get_devices() File "/home/homeassistant/homeassistant/custom_components/wyzeapi/wyzeapi/client.py", line 274, in get_devices response_json = await self.post_and_recover(WyzeApiConstants.get_devices_url, payload) File "/home/homeassistant/homeassistant/custom_components/wyzeapi/wyzeapi/client.py", line 78, in __post_and_recover raise ConnectionError("Failed to connect to the Wyze Service") ConnectionError: Failed to connect to the Wyze Service 2020-11-06 22:10:50 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Request to: https://api.wyzecam.com/app/v2/home_page/get_object_list failed with payload: {'phone_id': 'REDACTED', 'app_name': 'com.hualai.WyzeCam', 'app_version': '2.6.62', 'sc': '9f275790cab94a72bd206c8876429f3c', 'sv': '41267de22d1847c8b99bfba2658f88d7', 'phone_system_type': '1', 'appver': 'com.hualai.WyzeCam2.6.62', 'ts': '1604661049', 'access_token': 'REDACTED'} with result of {'ts': 1604661050483, 'code': '1006', 'msg': '', 'data': {}} 2020-11-06 22:10:50 ERROR (MainThread) [homeassistant.components.switch] Error while setting up wyzeapi platform for switch Traceback (most recent call last): File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity_platform.py", line 193, in _async_setup_platform await asyncio.shield(task) File "/home/homeassistant/homeassistant/custom_components/wyzeapi/switch.py", line 31, in async_setup_platform switches = await wyzeapi_client.list_switches() File "/home/homeassistant/homeassistant/custom_components/wyzeapi/wyzeapi/client.py", line 319, in list_switches await self.get_devices() File "/home/homeassistant/homeassistant/custom_components/wyzeapi/wyzeapi/client.py", line 274, in get_devices response_json = await self.post_and_recover(WyzeApiConstants.get_devices_url, payload) File "/home/homeassistant/homeassistant/custom_components/wyzeapi/wyzeapi/client.py", line 78, in __post_and_recover raise ConnectionError("Failed to connect to the Wyze Service") ConnectionError: Failed to connect to the Wyze Service 2020-11-06 22:10:51 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Request to: https://api.wyzecam.com/app/v2/home_page/get_object_list failed with payload: {'phone_id': 'REDACTED', 'app_name': 'com.hualai.WyzeCam', 'app_version': '2.6.62', 'sc': '9f275790cab94a72bd206c8876429f3c', 'sv': '41267de22d1847c8b99bfba2658f88d7', 'phone_system_type': '1', 'appver': 'com.hualai.WyzeCam2.6.62', 'ts': '1604661050', 'access_token': 'REDACTED'} with result of {'ts': 1604661051464, 'code': '1006', 'msg': '', 'data': {}} 2020-11-06 22:10:51 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up wyzeapi platform for binary_sensor Traceback (most recent call last): File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity_platform.py", line 193, in _async_setup_platform await asyncio.shield(task) File "/home/homeassistant/homeassistant/custom_components/wyzeapi/binary_sensor.py", line 51, in async_setup_platform contact_sensors = await wyzeapi_client.list_contact_sensors() File "/home/homeassistant/homeassistant/custom_components/wyzeapi/wyzeapi/client.py", line 329, in list_contact_sensors await self.get_devices() File "/home/homeassistant/homeassistant/custom_components/wyzeapi/wyzeapi/client.py", line 274, in get_devices response_json = await self.post_and_recover(WyzeApiConstants.get_devices_url, payload) File "/home/homeassistant/homeassistant/custom_components/wyzeapi/wyzeapi/client.py", line 78, in __post_and_recover raise ConnectionError("Failed to connect to the Wyze Service") ConnectionError: Failed to connect to the Wyze Service 2020-11-06 22:10:52 DEBUG (MainThread) [custom_components.wyzeapi.wyzeapi.client] Request to: https://api.wyzecam.com/app/v2/home_page/get_object_list failed with payload: {'phone_id': 'REDACTED', 'app_name': 'com.hualai.WyzeCam', 'app_version': '2.6.62', 'sc': '9f275790cab94a72bd206c8876429f3c', 'sv': '41267de22d1847c8b99bfba2658f88d7', 'phone_system_type': '1', 'appver': 'com.hualai.WyzeCam2.6.62', 'ts': '1604661051', 'access_token': 'REDACTED'} with result of {'ts': 1604661052217, 'code': '1006', 'msg': '', 'data': {}} 2020-11-06 22:10:52 ERROR (MainThread) [homeassistant.components.lock] Error while setting up wyzeapi platform for lock Traceback (most recent call last): File "/usr/local/share/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity_platform.py", line 193, in _async_setup_platform await asyncio.shield(task) File "/home/homeassistant/homeassistant/custom_components/wyzeapi/lock.py", line 39, in async_setup_platform locks = await wyzeapi_client.list_locks() File "/home/homeassistant/homeassistant/custom_components/wyzeapi/wyzeapi/client.py", line 324, in list_locks await self.get_devices() File "/home/homeassistant/homeassistant/custom_components/wyzeapi/wyzeapi/client.py", line 274, in get_devices response_json = await self.__post_and_recover(WyzeApiConstants.get_devices_url, payload) File "/home/homeassistant/homeassistant/custom_components/wyzeapi/wyzeapi/client.py", line 78, in __post_and_recover raise ConnectionError("Failed to connect to the Wyze Service") ConnectionError: Failed to connect to the Wyze Service

1h8fulkat commented 3 years ago

Same issue on 117.4. It started last night between 9:30pm-6am EST

davidlang42 commented 3 years ago

I opened the Wyze app manually and it asked me to log in, may or may not be related.

davidlang42 commented 3 years ago

Looking at the play store (Android) it seems the current app version is 2.14.35 (updated 20th October, ~2 weeks ago). I noticed in the log that the request states it is app version is 2.6.62, perhaps that version is no longer supported by the api?

1h8fulkat commented 3 years ago

My app is the current version. Getting the following errors

2020-11-06 06:19:07 ERROR (MainThread) [homeassistant.components.light] Error while setting up wyzeapi platform for light Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 197, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/wyzeapi/light.py", line 37, in async_setup_platform bulbs = await wyzeapi_client.list_bulbs() File "/config/custom_components/wyzeapi/wyzeapi/client.py", line 314, in list_bulbs await self.get_devices() File "/config/custom_components/wyzeapi/wyzeapi/client.py", line 274, in get_devices response_json = await self.post_and_recover(WyzeApiConstants.get_devices_url, payload) File "/config/custom_components/wyzeapi/wyzeapi/client.py", line 78, in __post_and_recover raise ConnectionError("Failed to connect to the Wyze Service") ConnectionError: Failed to connect to the Wyze Service 2020-11-06 06:19:08 ERROR (MainThread) [homeassistant.components.switch] Error while setting up wyzeapi platform for switch Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 197, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/wyzeapi/switch.py", line 31, in async_setup_platform switches = await wyzeapi_client.list_switches() File "/config/custom_components/wyzeapi/wyzeapi/client.py", line 319, in list_switches await self.get_devices() File "/config/custom_components/wyzeapi/wyzeapi/client.py", line 274, in get_devices response_json = await self.post_and_recover(WyzeApiConstants.get_devices_url, payload) File "/config/custom_components/wyzeapi/wyzeapi/client.py", line 78, in post_and_recover raise ConnectionError("Failed to connect to the Wyze Service") ConnectionError: Failed to connect to the Wyze Service 2020-11-06 06:19:09 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up wyzeapi platform for binary_sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 197, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/wyzeapi/binary_sensor.py", line 51, in async_setup_platform contact_sensors = await wyzeapi_client.list_contact_sensors() File "/config/custom_components/wyzeapi/wyzeapi/client.py", line 329, in list_contact_sensors await self.get_devices() File "/config/custom_components/wyzeapi/wyzeapi/client.py", line 274, in get_devices response_json = await self.__post_and_recover(WyzeApiConstants.get_devices_url, payload) File "/config/custom_components/wyzeapi/wyzeapi/client.py", line 78, in post_and_recover raise ConnectionError("Failed to connect to the Wyze Service") ConnectionError: Failed to connect to the Wyze Service 2020-11-06 06:19:09 ERROR (MainThread) [homeassistant.components.lock] Error while setting up wyzeapi platform for lock Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 197, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/wyzeapi/lock.py", line 39, in async_setup_platform locks = await wyzeapi_client.list_locks() File "/config/custom_components/wyzeapi/wyzeapi/client.py", line 324, in list_locks await self.get_devices() File "/config/custom_components/wyzeapi/wyzeapi/client.py", line 274, in get_devices response_json = await self.__post_and_recover(WyzeApiConstants.get_devices_url, payload) File "/config/custom_components/wyzeapi/wyzeapi/client.py", line 78, in __post_and_recover raise ConnectionError("Failed to connect to the Wyze Service") ConnectionError: Failed to connect to the Wyze Service

1h8fulkat commented 3 years ago

This resolved itself this morning. I think it was a Wyze API outage for a brief period.

SecKatie commented 3 years ago

Thank you for the feedback. I did some quick investigation and I see connection issues in my log as well but it is currently working. It must have been an outage of some type on their end.

Thanks to everyone for their contributions!