home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.07k stars 29.73k forks source link

Roborock - Login issue Dacite outdated but unclear how to identify #122411

Open madasus opened 1 month ago

madasus commented 1 month ago

The problem

`2024-07-22 14:28:50.992 ERROR (MainThread) [homeassistant.components.roborock.config_flow] Unexpected exception Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/dacite/types.py", line 22, in extract_origin_collection return collection.extra ^^^^^^^^^^^^^^^^^^^^ AttributeError: 'types.UnionType' object has no attribute 'extra'. Did you mean: 'str'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/roborock/containers.py", line 110, in from_dict return from_dict(cls, decamelize_obj(data, ignore_keys), config=Config(cast=[Enum])) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dacite/core.py", line 64, in from_dict value = _buildvalue(type=field_type, data=field_data, config=config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dacite/core.py", line 101, in _build_value if issubclass(type, cast_type): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dacite/types.py", line 168, in is_subclass if is_generic_collection(sub_type): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dacite/types.py", line 147, in is_generic_collection origin = extract_origincollection(type) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dacite/types.py", line 24, in extract_origin_collection return collection.origin ^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'types.UnionType' object has no attribute 'origin'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/roborock/config_flow.py", line 106, in async_step_code login_data = await self._client.code_login(code) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/roborock/web_api.py", line 179, in code_login return UserData.from_dict(user_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/roborock/containers.py", line 112, in from_dict raise RoborockException("It seems like you have an outdated version of dacite.") from err roborock.exceptions.RoborockException: It seems like you have an outdated version of dacite.`

when i do a pip show dacite i see this

dc9c689ba527:/config# pip show dacite Name: dacite Version: 1.8.1 Summary: Simple creation of data classes from dictionaries. Home-page: https://github.com/konradhalas/dacite Author: Konrad Hałas Author-email: halas.konrad@gmail.com License: MIT Location: /usr/local/lib/python3.12/site-packages Requires: Required-by: brother, gios, home-assistant-chip-clusters, nettigo_air_monitor, python-roborock

I think 1.8.1 is the correct version? any thoughts?

What version of Home Assistant Core has the issue?

core-2024.7.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Roborock

Link to integration documentation on our website

https://www.home-assistant.io/integrations/roborock

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

024-07-22 14:28:50.992 ERROR (MainThread) [homeassistant.components.roborock.config_flow] Unexpected exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/dacite/types.py", line 22, in extract_origin_collection
    return collection.__extra__
           ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'types.UnionType' object has no attribute '__extra__'. Did you mean: '__str__'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/roborock/containers.py", line 110, in from_dict
    return from_dict(cls, decamelize_obj(data, ignore_keys), config=Config(cast=[Enum]))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dacite/core.py", line 64, in from_dict
    value = _build_value(type_=field_type, data=field_data, config=config)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dacite/core.py", line 101, in _build_value
    if is_subclass(type_, cast_type):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dacite/types.py", line 168, in is_subclass
    if is_generic_collection(sub_type):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dacite/types.py", line 147, in is_generic_collection
    origin = extract_origin_collection(type_)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dacite/types.py", line 24, in extract_origin_collection
    return collection.__origin__
           ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'types.UnionType' object has no attribute '__origin__'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/roborock/config_flow.py", line 106, in async_step_code
    login_data = await self._client.code_login(code)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/roborock/web_api.py", line 179, in code_login
    return UserData.from_dict(user_data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/roborock/containers.py", line 112, in from_dict
    raise RoborockException("It seems like you have an outdated version of dacite.") from err
roborock.exceptions.RoborockException: It seems like you have an outdated version of dacite.

Additional information

dc9c689ba527:/config# pip show dacite Name: dacite Version: 1.8.1 Summary: Simple creation of data classes from dictionaries. Home-page: https://github.com/konradhalas/dacite Author: Konrad Hałas Author-email: halas.konrad@gmail.com License: MIT Location: /usr/local/lib/python3.12/site-packages Requires: Required-by: brother, gios, home-assistant-chip-clusters, nettigo_air_monitor, python-roborock

home-assistant[bot] commented 1 month ago

Hey there @lash-l, mind taking a look at this issue as it has been labeled with an integration (roborock) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `roborock` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign roborock` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


roborock documentation roborock source (message by IssueLinks)

gibokun commented 1 month ago

Hi I just updated my HA:

Core 2024.7.3 Supervisor 2024.06.2 Operating System 12.4 Frontend 20240710.0

Tried to add the Roborock integration and got the same issue.

<img width="572" alt="2024-07-23 13_04_57-Ajustes – Home Assistant" src="https://github.com/user-attachments/assets/9f1abfb3-e9b4-4fb0-8e7c-a8251fb6bbd5">

<img width="887" alt="image" src="https://github.com/user-attachments/assets/856b33af-2822-442a-a85e-7f00c4a7c939">

File "/usr/local/lib/python3.12/site-packages/roborock/containers.py", line 112, in from_dict
    raise RoborockException("It seems like you have an outdated version of dacite.") from err
roborock.exceptions.RoborockException: It seems like you have an outdated version of dacite.

Looks like Govee integration via HACS breaks Roborock integration due to use an outdated version of Dacite.

I will try what this guy said on ; https://github.com/LaggAt/hacs-govee/issues/169

"I am not sure what happends. After a few time uninstall the govee integration and the roborock integration and some reboots I can use both without any issue. Maybe the new HA version fixed it. I don't know what happends."

Good luck :D BR

madasus commented 1 month ago

Should have mentioned. I don’t use Govee and have never had it installed.

gibokun commented 1 month ago

Well something else must be on your case.

I just removed the Govee integration and the HACS, retry with Roborock, and worked at the first attempt :D

image

I will try to reinstall Govee now. Lets see if I can make both work.

madasus commented 1 month ago

@gibokun if you do

pip show dacite

on that host - what version do you see?

gibokun commented 1 month ago

Hi @madasus, I'm pretty noob so bare with me. (The terminal pip command is not recognized. so I'm not sure how to get that info you need :D )

I re added the Grove hacs and integration and roborok integration breaks.

Not sure what to do from here, nothing much on the logs,

image

I think I will disable the govee integration and try govee2mqtt

madasus commented 1 month ago

ok - i'll wait and see if the developer sees this.

Lash-L commented 1 month ago

You should update govee hacs to the latest version and that should resolve any issues.

madasus commented 1 month ago

@Lash-L I don't have or use Govee (HACS or otherwise). Are you saying I actually need to install Govee from HACS even though I am not using it?

Lash-L commented 1 month ago

Gotcha misread and thought you said you did.

Something is pinning it down. One of your hacs integrations, I recommend looking through all of them to figure out which one.

You can also download advance terminal and ssh addon -> Enable protected mode -> open web ui -> docker exec -it homeassistant bash -> pip show dacite

madasus commented 1 month ago

@Lash-L that was posted above and it shows version 1.8.1 which I thought was the correct version?

dc9c689ba527:/config# pip show dacite Name: dacite Version: 1.8.1 Summary: Simple creation of data classes from dictionaries. Home-page: https://github.com/konradhalas/dacite Author: Konrad Hałas Author-email: halas.konrad@gmail.com License: MIT Location: /usr/local/lib/python3.12/site-packages Requires: Required-by: brother, gios, home-assistant-chip-clusters, nettigo_air_monitor, python-roborock

Lash-L commented 1 month ago

You can try a uninstall of roborock -> restart HA -> install roborock

1.8.1 is the correct version, but sometimes with dependency resolutions weird things can happen. By doing this, you should make roborock reinstall everything

Lash-L commented 1 month ago

You could also try pip uninstall dacite and the reinstall

madasus commented 1 month ago

@Lash-L I tried

  1. Shutdown and removed the docker container and re-composed it from the latest image (that I assume covers the pip uninstall/reinstall

  2. I'm using the native Roborock integration and not the one from HACS. Maybe this is the issue? I thought we should be using the core integration now so there is nothing to uninstall?

Lash-L commented 1 month ago

@Lash-L I tried

  1. Shutdown and removed the docker container and re-composed it from the latest image (that I assume covers the pip uninstall/reinstall

I would explicitly uninstall and reinstall

  1. I'm using the native Roborock integration and not the one from HACS. Maybe this is the issue? I thought we should be using the core integration now so there is nothing to uninstall?

Yes you should be using core. By uninstall, I mean remove the devices.

madasus commented 1 month ago

@Lash-L

dc9c689ba527:/config# pip uninstall --root-user-action=ignore dacite WARNING: Skipping dacite as it is not installed.

dc9c689ba527:/config# pip install --root-user-action=ignore dacite Looking in indexes: https://pypi.org/simple, https://wheels.home-assistant.io/musllinux-index/ Collecting dacite Downloading https://wheels.home-assistant.io/musllinux-index/dacite-1.8.1-py3-none-any.whl (14 kB) Installing collected packages: dacite Successfully installed dacite-1.8.1

Same error still.

I had removed all the devices previously- I have no Roborock devices currently configured in HA.

madasus commented 1 month ago

Any more thoughts @Lash-L

Lash-L commented 2 weeks ago

@madasus some users have had success starting home assistant in safe mode - please try that