Error setting up xiaomi_miio platform in 0.61.1

i have the exact same problem. i upgrade to the 0.62 version of hass.io but the problem is not solved. any ideas?

Its construct packet issue hassio maintainer has to fix that

So we have only to Walt… or to downgrade.

1 Like

The construct issue was fixed:
https://github.com/rytilahti/python-miio/blob/master/requirements.txt#L4

Verified the versions I’m running (hass 0.62.1):
construct (2.9.25) and python-miio (0.3.4) and all other dependencies listed in python-miio requirements.txt.

Still no dice here though:

xiaomi_miio: Error on device update!
Traceback (most recent call last):
  File "/srv/hass/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 397, in _async_add_entity
    yield from entity.async_device_update(warning=False)
  File "/srv/hass/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 308, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 379, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 297, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 292, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass/lib/python3.5/site-packages/homeassistant/components/vacuum/xiaomi_miio.py", line 368, in update
    state = self._vacuum.status()
  File "/srv/hass/lib/python3.5/site-packages/miio/vacuum.py", line 108, in status
    return VacuumStatus(self.send("get_status")[0])
  File "/srv/hass/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

Anyone who has it working?

Please update python-miio, too. The line “Message.build(msg,…” was changed, too!

I am all running at latest @syssi!
Nogo… :confused:

Is it possibile to update it on hass.io? I am on the last version but it is still broken

Strange. Was running fine with everything on 0.62.0
Today did a clean install (Raspbian+manual python3.6.4+hass in venv 0.62.1) and now get the following

2018-01-31 19:35:29 ERROR (MainThread) [homeassistant.components.light] Error while setting up platform xiaomi_miio
Traceback (most recent call last):
  File "/srv/homeassistant/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/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 243, in result
    raise self._exception
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 180, in _step
    result = coro.send(None)
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 212, in coro
    res = func(*args, **kw)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/light/xiaomi_miio.py", line 76, in async_setup_platform
    device_info = light.info()
  File "/srv/homeassistant/lib/python3.6/site-packages/miio/device.py", line 271, in info
    return DeviceInfo(self.send("miIO.info", []))
  File "/srv/homeassistant/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

The same problem for me with my Philips Xiaomi bulb in 0.62.1

Error while setting up platform xiaomi_miio

I am running Hass.io, can anyone tell me how to fix it?

Did you managed to get the issue resolved?

I have the same setup as follow:

homeassistant : 0.62.1
python-miio: 0.3.4
construct: 2.9.23

Nope, just edited my post to make it more clear, I’m running all latest, but no dice unfortunately. The construct error is gone, but I still have:
TypeError: build() takes 2 positional arguments but 3 were given

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.