Error setting up xiaomi_miio platform in 0.61.1

My error is different…

2018-02-01 10:16:42 ERROR (MainThread) [homeassistant.components.vacuum] xiaomi_miio: Error on device update!
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py”, line 397, in _async_add_entity
yield from entity.async_device_update(warning=False)
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 308, in async_device_update
yield from self.hass.async_add_job(self.update)
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/futures.py”, line 327, in iter
yield self # This tells Task to wait for completion.
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/tasks.py”, line 250, in _wakeup
future.result()
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/futures.py”, line 243, in result
raise self._exception
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/homeassistant/components/vacuum/xiaomi_miio.py”, line 368, in update
state = self._vacuum.status()
File “/Users/zachwong/.homeassistant/deps/lib/python/site-packages/miio/vacuum.py”, line 108, in status
return VacuumStatus(self.send(“get_status”)[0])
File “/Users/zachwong/.homeassistant/deps/lib/python/site-packages/miio/device.py”, line 216, in send
m = Message.build(msg, ctx)
TypeError: build() takes 2 positional arguments but 3 were given

Look at your last line :slight_smile:
TypeError: build() takes 2 positional arguments but 3 were given

Looks the same too! :slight_smile:
Hopefully that can be fixed soon.

Just update python-miio:

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

sorrrry for the nnoob questionn, but therre is a particular code to use to innstall it on hass.io?

You could try this approach: Miio platform broken after upgrade 0.62 - #17 by BarryHampants

ok, so the fix you provide isn’t persistent, short story: hass.io users only have to wait for the next release?

@zajnic I’m having the same problem.
Did you solve this issue?

I’m running hassbian with:
homeassistant Version: 0.62.1
python-miio Version: 0.3.4
construct Version: 2.9.25

Got this error:

2018-02-01 10:16:26 ERROR (MainThread) [miio.device] Unable to discover a device at address 10.0.0.118
2018-02-01 10:16:26 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform xiaomi_miio
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/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.5/asyncio/tasks.py", line 400, in wait_for
    return fut.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/usr/lib/python3.5/asyncio/coroutines.py", line 210, in coro
    res = func(*args, **kw)
  File "/home/homeassistant/.homeassistant/custom_components/switch/xiaomi_miio.py", line 51, in async_setup_platform
    device_info = plug.info()
  File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 271, in info
    return DeviceInfo(self.send("miIO.info", []))
  File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 216, in send
    m = Message.build(msg, ctx)
TypeError: build() takes 2 positional arguments but 3 were given
2018-02-01 10:16:26 WARNING (MainThread) [homeassistant.components.light] Platform xiaomi_miio not ready yet. Retrying in 30 seconds.
2018-02-01 10:17:20 ERROR (MainThread) [miio.device] Unable to discover a device at address 10.0.0.118
2018-02-01 10:17:21 WARNING (MainThread) [homeassistant.components.light] Platform xiaomi_miio not ready yet. Retrying in 60 seconds.
2018-02-01 10:18:27 ERROR (MainThread) [miio.device] Unable to discover a device at address 10.0.0.118
2018-02-01 10:18:27 WARNING (MainThread) [homeassistant.components.light] Platform xiaomi_miio not ready yet. Retrying in 90 seconds.
2018-02-01 10:20:03 ERROR (MainThread) [miio.device] Unable to discover a device at address 10.0.0.118
2018-02-01 10:20:03 WARNING (MainThread) [homeassistant.components.light] Platform xiaomi_miio not ready yet. Retrying in 120 seconds.

as you can read above, the problem is not fix yet.
You can try the method provided by @syssi but it’s not persistent.

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.