Miio platform broken after upgrade 0.62

Hi,

Looks like the HA 0.62 version has the same bug 0.61.1 used to have

Is there any workaround? I am using hass.io, how can I switch to developpment
Issue is logged here

2018-01-28 21:50:38 ERROR (MainThread) [homeassistant.components.vacuum] 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 245, 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 210, in coro
res = func(*args, **kw)
File “/usr/lib/python3.6/site-packages/homeassistant/components/vacuum/xiaomi_miio.py”, line 90, in async_setup_platform
from miio import Vacuum
File “/usr/lib/python3.6/site-packages/miio/init.py”, line 2, in
from miio.protocol import Message, Utils
File “/usr/lib/python3.6/site-packages/miio/protocol.py”, line 179, in
Const(0x2131, Int16ub),
File “/usr/lib/python3.6/site-packages/construct/core.py”, line 1894, in init
super(Const, self).init(subcon)
File “/usr/lib/python3.6/site-packages/construct/core.py”, line 291, in init
raise TypeError(“subcon should be a Construct field”)
TypeError: subcon should be a Construct field

I can confirm this too. My WiFi switches have disappeared.

same issue for me. Philips LED white light globes disappeared after upgrading to 0.62

I have the same issue. Wifi switch disappeared.

1 Like

@DavidFW1960 @peterho @Yunseok_Oh @AsWaM Please provide the following informations:

# output of
pip show homeassistant | grep Version:
pip show python-miio | grep Version:
pip show construct | grep Version:

Describe how do you install/use homeassistant: hassio, hassbian, virtualenv, simple install

Working combinations are:

homeassistant<=0.60.1 + python-miio<=0.3.2 + construct<=2.8.17
homeassistant=0.61 + python-miio=0.3.3 + construct=2.8.17
homeassistant=0.62 + python-miio=0.3.4 + construct=2.8.22
homeassistant dev + python-miio master + construct=2.9.23

As you can see api changes of construct broke the library three times in a row now. :frowning: :frowning:

Hassio won’t let me do that All not found errors

Please open a shell inside of your docker container and execute the commands there:

# list the containers
docker ps -notrunc
# start a shell
docker exec -it "id of the homeassistant container" bash

| | | | |_ / __
| |__| | __ _ ___ ___ | || | | |
| __ |/ ` / __/ __| | || | | |
| | | | (
| _
__ _ | || |__| |
|
| ||_,|/()___/

Our Cli:
$ hassio help

debug1: permanently_set_uid: 0/0
core-ssh:~# docker ps -notrunc
-bash: docker: command not found
core-ssh:~#

Okay. I cannot help here. My knowledge about docker is limited.

I was having problems this weekend too. I had upgraded the miio component manually when I was having problems with 0.61. I got them working again in 0.62 by deleting the component files from the home-assistant lib directory. I’m also running docker.

Thanks for trying. Hopefully 0.62.1 will fix it…

I will care about.

I have the same issue with Xiaomi Air Purifier 2.

If you don’t use hassio you can simply update python-miio and construct.

I use hassio :frowning:

Using Hassio. Updated to 0.62.1 this morning. Still not working. Error as follows for both switches:

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 245, 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 210, in coro
    res = func(*args, **kw)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/switch/xiaomi_miio.py", line 41, in async_setup_platform
    from miio import Device, DeviceException
  File "/usr/lib/python3.6/site-packages/miio/__init__.py", line 2, in <module>
    from miio.protocol import Message, Utils
  File "/usr/lib/python3.6/site-packages/miio/protocol.py", line 179, in <module>
    Const(0x2131, Int16ub),
  File "/usr/lib/python3.6/site-packages/construct/core.py", line 1894, in __init__
    super(Const, self).__init__(subcon)
  File "/usr/lib/python3.6/site-packages/construct/core.py", line 291, in __init__
    raise TypeError("subcon should be a Construct field")
TypeError: subcon should be a Construct field

Is there any way to fix this?

Just chipping in to say also on Hassio, all things requiring a token have disappeared on me a. Should have checked the forum before troubleshooting.

I think this might need to be done on the hassio container end for those on a pi.

I’m running on ubuntu and have installed hassio manually so have access to the container.

Following instructions provided by @syssi I have got my things back on 62.1 with

# list the containers
docker ps -a
# start a shell
docker exec -it "id of the homeassistant container" bash

pip3 install https://github.com/rytilahti/python-miio/archive/master.zip
pip3 install construct==2.8.22
1 Like

core-ssh:~# docker ps -a
-bash: docker: command not found
core-ssh:~#

I’m not sure of your environment but I have manually installed docker on my machine to run other services besides hassio and not used the NUC image. I’ll try to find the install procedure I followed and link it in later.

docker ps -a

just lists all the containers. I can see you have the same error using

docker ps -notrunc

Does the user you are logged in with have docker privileges?

I’m using the Hassio install on a Pi. THere is no access to almost anything from the command line.