romedtino / simple-wyze-vac

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

Error setting up new integration. #32

Closed justinmyersm closed 2 years ago

justinmyersm commented 2 years ago

I was using the previous version fine, then when I upgraded to the new version, I get the following error:

This error originated from a custom integration.

Logger: homeassistant.config_entries Source: custom_components/simple_wyze_vac/init.py:81 Integration: Simple Wyze Vac (documentation) First occurred: 11:27:16 PM (1 occurrences) Last logged: 11:27:16 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 339, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/simple_wyze_vac/init.py", line 81, in async_setup_entry "room_manager": room_manager UnboundLocalError: local variable 'room_manager' referenced before assignment

This has been the same error I have received each time I have attempted to set it up. I uninstalled the custom integration, removed any reference in configuration.yaml, and removed the custom respiratory in HACS. I restarted HA and didn't add it back for a couple of days. I did a Core update to HA along with an OS update and figured I would give it another shot; same error.

Home Assistant Core 2022.6.1 Home Assistant Supervisor 2022.05.3 Home Assistant OS 8.1 Wyze Vacuum Firmware 1.6.173 Wyze Vacuum Plugin 2.31.9

romedtino commented 2 years ago

Hm this is definitely a bug on my part fix incoming.

justinmyersm commented 2 years ago

Thank you! If there is any more information you need from me, I will be happy to provide more details.

mboarman commented 2 years ago

I am having the same issue, was working great and now the integration is showing "Failed to set up". I'm not using any 2FA.

Log Details:

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 339, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/simple_wyze_vac/__init__.py", line 67, in async_setup_entry
    vac_info = await hass.async_add_executor_job(lambda: client.vacuums.info(device_mac=device.mac))
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/simple_wyze_vac/__init__.py", line 67, in <lambda>
    vac_info = await hass.async_add_executor_job(lambda: client.vacuums.info(device_mac=device.mac))
  File "/usr/local/lib/python3.9/site-packages/wyze_sdk/api/devices/vacuums.py", line 51, in info
    current_map = super()._venus_client().get_current_map(did=device_mac)
  File "/usr/local/lib/python3.9/site-packages/wyze_sdk/service/venus_service.py", line 52, in get_current_map
    return self.api_call('/plugin/venus/memory_map/current_map', http_verb="GET", params=kwargs)
  File "/usr/local/lib/python3.9/site-packages/wyze_sdk/service/venus_service.py", line 37, in api_call
    return super().api_call(
  File "/usr/local/lib/python3.9/site-packages/wyze_sdk/service/base.py", line 339, in api_call
    return super().api_call(
  File "/usr/local/lib/python3.9/site-packages/wyze_sdk/service/base.py", line 198, in api_call
    return self.do_get(url=api_url, headers=headers, payload=params)
  File "/usr/local/lib/python3.9/site-packages/wyze_sdk/service/base.py", line 143, in do_get
    return self._do_request(client, req)
  File "/usr/local/lib/python3.9/site-packages/wyze_sdk/service/base.py", line 93, in _do_request
    return WyzeResponse(
  File "/usr/local/lib/python3.9/site-packages/wyze_sdk/service/wyze_response.py", line 142, in validate
    raise e.WyzeApiError(message, self.data)
wyze_sdk.errors.WyzeApiError: The request to the Wyze API failed.
The server responded with: {'code': 1000, 'current': 0, 'data': None, 'hash': '1', 'instance_id': 'caead6f7c895c5fa11aaa0c8fb71b401', 'isShowToast': 0, 'message': 'Internal service error', 'toastMsg': None, 'total': 0, 'version': 1
romedtino commented 2 years ago

Perhaps the Wyze servers were down during this time? Looking at that error log, there's not much on my end that I can see changing as the errors seem to just be accessing the Wyze servers themselves.

I just tried removing/ adding my own credentials (no 2FA) and I logged in just fine.

Can you share your vacuum firmware version?

mboarman commented 2 years ago

What's weird is the integration accepts the username and password (I did not enter a base32 key) but when I go to the HA integration screen. It shows as "setup failed".

My firmware is - 1.6.202

romedtino commented 2 years ago

I see, that firmware version is higher than the current release of 1.6.113 maybe Wyze did something again and changed how the API works for newer firmware. I can take a look a bit more but this might just be another Wyze API change and could be something that needs to be modified on the wyze-sdk side. 1.6.202 is even newer than the 1.6.173 that was floating around...

mboarman commented 2 years ago

Ugh! I was hoping for a simple fix. My wife is not happy! lol....Please keep us posted if you find anything. Thanks!!

mboarman commented 2 years ago

Update: Went and tried installing the integration again tonight and IT WORKED! It had to be something on the Wyze end. Hopefully it stays in place! Sorry for the fire drill!

romedtino commented 2 years ago

Great! Glad it's working!