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

xiaomi miio integration error #47710

Closed
hats0id opened this issue Mar 10, 2021 · 8 comments
Closed

xiaomi miio integration error #47710

hats0id opened this issue Mar 10, 2021 · 8 comments

Comments

@hats0id
Copy link

hats0id commented Mar 10, 2021

The problem

When i try to add xiaomi miio integration - i got following error: "Config flow could not be loaded"

What is version of Home Assistant Core has the issue?

core-2021.3.3

What was the last working version of Home Assistant Core?

core-2021.2.1

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

xiaomi miio

Link to integration documentation on our website

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

Example YAML snippet

No response

Anything in the logs that might be useful for us?

# Put your logs below this line
2021-03-10 13:44:30 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration xiaomi_miio: cannot import name 'GatewayException' from 'miio.gateway' (/usr/local/lib/python3.8/site-packages/miio/gateway.py)
2021-03-10 13:44:30 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 561, in async_create_flow
    integration.get_platform("config_flow")
  File "/usr/src/homeassistant/homeassistant/loader.py", line 499, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 504, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/__init__.py", line 5, in <module>
    from miio.gateway import GatewayException
ImportError: cannot import name 'GatewayException' from 'miio.gateway' (/usr/local/lib/python3.8/site-packages/miio/gateway.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 122, in async_init
    flow = await self.async_create_flow(handler, context=context, data=data)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 568, in async_create_flow
    raise data_entry_flow.UnknownHandler
homeassistant.data_entry_flow.UnknownHandler
2021-03-10 13:54:00 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration xiaomi_miio: cannot import name 'GatewayException' from 'miio.gateway' (/usr/local/lib/python3.8/site-packages/miio/gateway.py)
2021-03-10 13:54:00 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 561, in async_create_flow
    integration.get_platform("config_flow")
  File "/usr/src/homeassistant/homeassistant/loader.py", line 499, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 504, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/__init__.py", line 5, in <module>
    from miio.gateway import GatewayException
ImportError: cannot import name 'GatewayException' from 'miio.gateway' (/usr/local/lib/python3.8/site-packages/miio/gateway.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 122, in async_init
    flow = await self.async_create_flow(handler, context=context, data=data)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 568, in async_create_flow
    raise data_entry_flow.UnknownHandler
homeassistant.data_entry_flow.UnknownHandler
2021-03-10 13:57:06 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration xiaomi_miio: cannot import name 'GatewayException' from 'miio.gateway' (/usr/local/lib/python3.8/site-packages/miio/gateway.py)
2021-03-10 13:58:42 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration xiaomi_miio: cannot import name 'GatewayException' from 'miio.gateway' (/usr/local/lib/python3.8/site-packages/miio/gateway.py)
2021-03-10 13:58:42 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 561, in async_create_flow
    integration.get_platform("config_flow")
  File "/usr/src/homeassistant/homeassistant/loader.py", line 499, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 504, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/__init__.py", line 5, in <module>
    from miio.gateway import GatewayException
ImportError: cannot import name 'GatewayException' from 'miio.gateway' (/usr/local/lib/python3.8/site-packages/miio/gateway.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 122, in async_init
    flow = await self.async_create_flow(handler, context=context, data=data)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 568, in async_create_flow
    raise data_entry_flow.UnknownHandler
homeassistant.data_entry_flow.UnknownHandler

Related to moving configuration from configuration.yaml to GUI.

@hats0id
Copy link
Author

hats0id commented Mar 14, 2021

Am i alone here?

@rytilahti
Copy link
Member

ImportError: cannot import name 'GatewayException' from 'miio.gateway' is the relevant error here. If you are using custom xiaomi integrations they may cause this due to pinning to older versions of python-miio library.

Ping @starkillerOG (the bot didn't do its work again...)

@hats0id
Copy link
Author

hats0id commented Mar 14, 2021

ImportError: cannot import name 'GatewayException' from 'miio.gateway' is the relevant error here. If you are using custom xiaomi integrations they may cause this due to pinning to older versions of python-miio library.

Ping @starkillerOG (the bot didn't do its work again...)

i am using custom mii2 integration, cause AFAIK my viomi.v8 still is not supported in python-miio. Will try to remove it and try again.

@hats0id
Copy link
Author

hats0id commented Mar 14, 2021

I have two news:

  1. after removing mii2 integration - problem has gone
  2. i can't add chuangmi.ir.v2. In logs i see:

2021-03-14 21:01:33 DEBUG (MainThread) [homeassistant.components.xiaomi_miio.device] chuangmi.ir.v2 1.2.4_38 MC200 detected

I got error message after i enter ip and token : "The device model is not known, not able to setup the device using config flow."

Amd tell me please if you are workin on adding support for viomi.v8? Thank you very much

@rytilahti
Copy link
Member

The remote platform is not yet supported via config flow, so you will need to configure that using the yaml configuration as far as I know.

Regarding to viomi support, the backend library already has that, but it will require some more work to get it properly integrated to homeassistant. There is an issue for that (#27268), but there has been so far no volunteers who'd push proper integration onward. With the recent developments done by @starkillerOG on config flows, integrating non-rockrobo vacuums properly would be much simpler than it used to be. So if anyone wants to do the work, I am happy to help with code reviews & getting necessary changes into python-miio.

@starkillerOG
Copy link
Contributor

@rytilahti thanks for already handeling most of the explanation, you are right.

  • chuangmi.ir.v2 schould be done in YAML: https://www.home-assistant.io/integrations/xiaomi_miio/#xiaomi-ir-remote
  • regarding viomi.v8, I don't have a robot vacuum (yet), so can't really program it if I don't have the device (although I would like to have a robot vacuum at some point), sorry.
  • The import error you are seeing ImportError: cannot import name 'GatewayException' from 'miio.gateway' schould be fixed by importing from 'miio.gateway.gateway' instead of 'miio.gateway' when you are using python-miio 0.5.5, The latest dev version of HomeAssistant already has those changes merged. The current released version of HomeAssistant still uses python-miio 0.5.4 which schould import from 'miio.gateway'. If you don't use custom components it will just work, if you use custom components, make sure to imports match the python-miio version (and please report this to the maintainers of those custom components/make a PR for them).

@starkillerOG
Copy link
Contributor

So:

  • python-miio 0.5.4 --> import from 'miio.gateway'
  • python-miio 0.5.5 --> import from 'miio.gateway.gateway'

@syssi
Copy link
Member

syssi commented Apr 10, 2021

Please update to the latest HA release. This issue should be fixed. If not please re-open the issue or create a specific new one.

@syssi syssi closed this as completed Apr 10, 2021
@github-actions github-actions bot locked and limited conversation to collaborators May 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants