Error setting up xiaomi_miio platform in 0.61.1

Tried to do this, but get an error:

 Ignoring typing: markers 'python_version < "3.5"' don't match your environment

Waiting of a new homeassistant release (fix included) is the easiest solution for all! :wink:

It looks like “pip install” uses python2 and you should use pip3 for python3:

pip3 install https://github.com/rytilahti/python-miio/archive/master.zip

Same issue:

python3 --version
Python 3.5.3

sudo pip3 install https://github.com/rytilahti/python-miio/archive/master.zip

Ignoring typing: markers 'python_version < "3.5"' don't match your environment

Please describe your system. How did you install homeassistant? I assume you are using a python virtualenv and missed to enter the environment beforehand (f.e. source /srv/homeassistant/bin/active).

I’m running hassbian on RPI3.

Even if I use source /srv/homeassistant/bin/activate before the install, I get the same error:

pi@hassbian:~ $ source /srv/homeassistant/bin/activate
(homeassistant) pi@hassbian:~ $ sudo pip3 install https://github.com/rytilahti/p                                          ython-miio/archive/master.zip
Collecting https://github.com/rytilahti/python-miio/archive/master.zip
  Downloading https://github.com/rytilahti/python-miio/archive/master.zip (115kB                                          )
    100% |████████████████████████████████| 122kB 189kB/s
  Requirement already satisfied (use --upgrade to upgrade): python-miio==0.3.4 f                                          rom https://github.com/rytilahti/python-miio/archive/master.zip in /usr/local/li                                          b/python3.5/dist-packages
  Ignoring typing: markers 'python_version < "3.5"' don't match your environment
Requirement already satisfied: android_backup in /usr/local/lib/python3.5/dist-p                                          ackages (from python-miio==0.3.4)
Requirement already satisfied: appdirs in /usr/local/lib/python3.5/dist-packages                                           (from python-miio==0.3.4)
Requirement already satisfied: attrs in /usr/local/lib/python3.5/dist-packages (                                          from python-miio==0.3.4)
Requirement already satisfied: click in /usr/local/lib/python3.5/dist-packages (                                          from python-miio==0.3.4)
Requirement already satisfied: construct>=2.9.23 in /usr/local/lib/python3.5/dis                                          t-packages (from python-miio==0.3.4)
Requirement already satisfied: cryptography in /usr/local/lib/python3.5/dist-pac                                          kages (from python-miio==0.3.4)
Requirement already satisfied: pretty_cron in /usr/local/lib/python3.5/dist-pack                                          ages (from python-miio==0.3.4)
Requirement already satisfied: pytz in /usr/local/lib/python3.5/dist-packages (f                                          rom python-miio==0.3.4)
Requirement already satisfied: zeroconf in /usr/local/lib/python3.5/dist-package                                          s (from python-miio==0.3.4)
Requirement already satisfied: cffi>=1.7; platform_python_implementation != "PyP                                          y" in /usr/local/lib/python3.5/dist-packages (from cryptography->python-miio==0.                                          3.4)
Requirement already satisfied: six>=1.4.1 in /usr/local/lib/python3.5/dist-packa                                          ges (from cryptography->python-miio==0.3.4)
Requirement already satisfied: idna>=2.1 in /usr/local/lib/python3.5/dist-packag                                          es (from cryptography->python-miio==0.3.4)
Requirement already satisfied: asn1crypto>=0.21.0 in /usr/local/lib/python3.5/di                                          st-packages (from cryptography->python-miio==0.3.4)
Requirement already satisfied: enum-compat in /usr/local/lib/python3.5/dist-pack                                          ages (from zeroconf->python-miio==0.3.4)
Requirement already satisfied: netifaces!=0.10.5 in /usr/local/lib/python3.5/dis                                          t-packages (from zeroconf->python-miio==0.3.4)
Requirement already satisfied: pycparser in /usr/local/lib/python3.5/dist-packag                                          es (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography->pyth                                          on-miio==0.3.4)

Okay, if you are running hassbian you have to change the user first:

su - homeassistant
source /srv/homeassistant/bin/activate
pip3 install -U https://github.com/rytilahti/python-miio/archive/master.zip

and enable the “upgrade”-Flag ("-U")

2 Likes

Thank you. It worked. Sorry, but I’m not an linux expert, Thank You for your help.

1 Like

Tried that, not fixing the issue. Got the error
" Ignoring typing: markers ‘python_version < “3.5”’ don’t match your environment"

I am running hass on mac mini.

1 Like

Thanks! Finally got the V2 machine working. V1 was working fine before. Odd.

I’ve been struggling with this error since upgrading to 0.62, thanks for the details on how to fix it.

Still not working here.

Running hass on an archlinux vm. Running latest builds as described here, have also tried various other combos of construct and miio but no joy. Perhaps I need to downgrade hass to 62.0?

[root@home ~]# pip3 show homeassistant | grep Version:
Version: 0.62.1
[root@home ~]# pip3 show construct | grep Version:
Version: 2.9.27
[root@home ~]# pip3 show python-miio | grep Version:
Version: 0.3.5
[root@home ~]# python3 --version
Python 3.6.4


Error while setting up platform xiaomi_miio
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 189, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
return fut.result()
File "/usr/lib/python3.6/asyncio/futures.py", line 243, in result
raise self._exception
File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
result = coro.send(None)
File "/usr/lib/python3.6/asyncio/coroutines.py", line 212, in coro
res = func(*args, **kw)
File "/usr/lib/python3.6/site-packages/homeassistant/components/switch/xiaomi_miio.py", line 52, in async_setup_platform
device_info = plug.info()
File "/root/.homeassistant/deps/lib/python3.6/site-packages/miio/device.py", line 271, in info
return DeviceInfo(self.send("miIO.info", []))
File "/root/.homeassistant/deps/lib/python3.6/site-packages/miio/device.py", line 216, in send
m = Message.build(msg, ctx)
TypeError: build() takes 2 positional arguments but 3 were given

Ok, so tried downgrade to homeassistant 0.62.0 … still no joy

[root@home ~]# pip3 show homeassistant | grep Version:
Version: 0.62.0
[root@home ~]# pip3 show python-miio | grep Version:
Version: 0.3.4
[root@home ~]# pip3 show construct | grep Version:
Version: 2.8.22

According to this thread, the combo above should work, but it doesn’t :frowning:

( although that thread does describe a slightly different error).

Updated to hass dev, with latest construct and python-miio - still broken.

Wondering if it’s a python 3.6 problem?

Nope. You are mixing things up! You’ve installed python-miio & construct multiple times. If you use “pip show” as root the path “/usr/lib/python3.6/site-packages/” is used. As you can see in your error message:

File "/root/.homeassistant/deps/lib/python3.6/site-packages/miio/device.py", line 271, in info
return DeviceInfo(self.send("miIO.info", []))
File "/root/.homeassistant/deps/lib/python3.6/site-packages/miio/device.py", line 216, in send
m = Message.build(msg, ctx)

python-miio is used from “/root/.homeassistant/deps/lib/python3.6/site-packages”. Just try to check the version of python-miio directly:

cat /root/.homeassistant/deps/lib/python3.6/site-packages/miio/version.py

It return “0.3.4”, right? The dev branch of homeassistant is fixed now. Just update homeassistant. It will pull all required components automatically now.

Thanks for the help @syssi

You are correct in that i have been installing construct and python_miio multiple times. I have been using the commands

 pip3 install https://github.com/rytilahti/python-miio/archive/master.zip
 pip3 install construct==x.xx.x 

etc
Each time these commands seem to uninstall the current version of the component, and install the requested one.
Are these commands not installing into the location that homeassistant is using? If not, how do I make them install to the correct location for homeassistant ? (sorry, still learning linux)

As per your request, I’ve checked the version inside the .homeassistant folder:

[root@home ~]# cat /root/.homeassistant/deps/lib/python3.6/site-packages/miio/version.py
# flake8: noqa
__version__ = "0.3.4"

I then upgraded homeassistant:

 pip3 install --upgrade git+git://github.com/home-assistant/home-assistant.git@dev

However, cat /root/.homeassistant/deps/lib/python3.6/site-packages/miio/version.py still shows:

__version__ = "0.3.4"

Current pip3 show outputs:

[root@home ~]# pip3 show construct | grep Version:
Version: 2.9.27
[root@home ~]# pip3 show python-miio | grep Version:
Version: 0.3.5
[root@home ~]# pip3 show homeassistant | grep Version:
Version: 0.63.0.dev0

same problem on hassio 0.63

Yes for me too, still the same problem on 0.63 :frowning:

@Alessandro_Morrone @2xdehelft Do you use hassio?

https://github.com/home-assistant/hassio/issues/356
https://github.com/home-assistant/home-assistant/issues/12298
https://github.com/home-assistant/home-assistant/issues/12028

it’s a neverending story…