Cannot Connect Xiaomi Mi Wifi Socket

Hi everyone,

I recently got a Xiaomi Mi Smart Wifi Socket and have configured it in the configuration.yaml and made sure everything was correct. But when I go to run home assistant, I get

2018-01-08 17:42:48 ERROR (MainThread) [miio.device] Got error when receiving: timed out 2018-01-08 17:42:48 WARNING (MainThread) [miio.device] Retrying with incremented id, retries left: 1

three times then,

2018-01-08 17:42:53 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting 2018-01-08 17:42:53 WARNING (MainThread) [homeassistant.components.switch] Setup of platform xiaomi_miio is taking over 10 seconds. 2018-01-08 17:42:53 WARNING (MainThread) [homeassistant.components.switch] Platform xiaomi_miio not ready yet. Retrying in 180 seconds.

Then,

2018-01-08 18:11:46 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform xiaomi_plug Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 171, in _async_setup_platform SLOW_SETUP_MAX_WAIT, loop=self.hass.loop) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/tasks.py", line 358, in wait_for return fut.result() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/futures.py", line 245, in result raise self._exception File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/tasks.py", line 180, in _step result = coro.send(None) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/coroutines.py", line 210, in coro res = func(*args, **kw) File "/Users/Privitelli/.homeassistant/custom_components/switch/xiaomi_plug.py", line 49, in async_setup_platform device_info = plug.info() File "/Users/Privitelli/.homeassistant/deps/lib/python/site-packages/miio/device.py", line 274, in info return DeviceInfo(self.send("miIO.info", [])) File "/Users/Privitelli/.homeassistant/deps/lib/python/site-packages/miio/device.py", line 201, in send self.do_discover() File "/Users/Privitelli/.homeassistant/deps/lib/python/site-packages/miio/device.py", line 127, in do_discover m = Device.discover(self.ip) File "/Users/Privitelli/.homeassistant/deps/lib/python/site-packages/miio/device.py", line 169, in discover s.sendto(helobytes, (addr, 54321))

The plugs never show up in home assistant. I am running version 0.60.0 on a mac.

Thanks and your help would be appreciated.

I’m having the same issue and after doing some research it seems to be related to this:

https://github.com/home-assistant/home-assistant/pull/11232

Hopefully it’ll be fixed soon.

Is there a way to downgrade to the version that was working before?

I found a way to fix it. Navigate to your .homeassistant folder where your configuration.yaml is, then go to deps>lib>python>site-packages.

Now download the latest and fixed version off python-miio -https://github.com/rytilahti/python-miio/archive/0.3.3.zip

Now in the zip you downloaded there should be two folders, one called miio and on called mirobo. Replace the folders called the same thing in the path you navigated to earlier.

Now you have the upgraded version of miio that works! Restart home assistant and it should work.

I’ll give that a try. According to the pull request it should be fixed in 0.61 but not sure when that’ll be released. I also tried switching to the dev branch but that didn’t solve it unfortunately.