Home Assistant release (hass --version
):
0.59.2
Python release (python3 --version
):
Python 3.5.3
Component/platform:
vacuum, xiaomi_miio
Description of problem:
After upgrading to 0.59.2 from 0.58.1 the Xiaomi vacuum robot is unavailable.
Expected:
Problem-relevant configuration.yaml
entries and steps to reproduce:
**configuration.yaml:**
vacuum:
- platform: xiaomi_miio
name: 'wolfe'
host: 10.10.0.16
token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Traceback (if applicable):
2017-12-09 16:06:16 INFO (MainThread) [homeassistant.loader] Loaded vacuum.xiaomi_miio from homeassistant.components.vacuum.xiaomi_miio
2017-12-09 16:06:37 DEBUG (Thread-3) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2017-12-09 16:06:37 DEBUG (Thread-3) [miio.device] Got a response: Container:
data = Container:
offset1 = 32
offset2 = 32
length = 0
data = (total 0)
value = (total 0)
header = Container:
offset1 = 0
offset2 = 16
length = 16
data = !1\x00 \x00\x00\x00\x00\x03\xd7\xe6(Z+\xfb\xfc (total 16)
value = Container:
length = 32
unknown = 0
devtype = default (total 7)
serial = 58920
ts = 2017-12-09 15:06:36
checksum = \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff (total 16)
2017-12-09 16:06:37 DEBUG (Thread-3) [miio.device] Discovered default 58920 with ts: 2017-12-09 15:06:36, token: b'ffffffffffffffffffffffffffffffff'
2017-12-09 16:06:39 DEBUG (Thread-3) [miio.device] 10.10.0.16:54321 >>: {'method': 'get_status', 'id': 1}
2017-12-09 16:06:44 ERROR (Thread-3) [miio.device] Got error when receiving: timed out
2017-12-09 16:06:44 WARNING (Thread-3) [miio.device] Retrying with incremented id, retries left: 3
2017-12-09 16:06:44 DEBUG (Thread-3) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2017-12-09 16:06:44 DEBUG (Thread-3) [miio.device] Got a response: Container:
data = Container:
offset1 = 32
offset2 = 32
length = 0
data = (total 0)
value = (total 0)
header = Container:
offset1 = 0
offset2 = 16
length = 16
data = !1\x00 \x00\x00\x00\x00\x03\xd7\xe6(Z+\xfc\x03 (total 16)
value = Container:
length = 32
unknown = 0
devtype = default (total 7)
serial = 58920
ts = 2017-12-09 15:06:43
checksum = \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff (total 16)
2017-12-09 16:06:44 DEBUG (Thread-3) [miio.device] Discovered default 58920 with ts: 2017-12-09 15:06:43, token: b'ffffffffffffffffffffffffffffffff'
2017-12-09 16:06:44 DEBUG (Thread-3) [miio.device] 10.10.0.16:54321 >>: {'method': 'get_status', 'id': 102}
2017-12-09 16:06:49 ERROR (Thread-3) [miio.device] Got error when receiving: timed out
2017-12-09 16:06:49 WARNING (Thread-3) [miio.device] Retrying with incremented id, retries left: 2
2017-12-09 16:06:49 DEBUG (Thread-3) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2017-12-09 16:06:49 DEBUG (Thread-3) [miio.device] Got a response: Container:
data = Container:
offset1 = 32
offset2 = 32
length = 0
data = (total 0)
value = (total 0)
header = Container:
offset1 = 0
offset2 = 16
length = 16
data = !1\x00 \x00\x00\x00\x00\x03\xd7\xe6(Z+\xfc\x08 (total 16)
value = Container:
length = 32
unknown = 0
devtype = default (total 7)
serial = 58920
ts = 2017-12-09 15:06:48
checksum = \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff (total 16)
2017-12-09 16:06:49 DEBUG (Thread-3) [miio.device] Discovered default 58920 with ts: 2017-12-09 15:06:48, token: b'ffffffffffffffffffffffffffffffff'
2017-12-09 16:06:49 DEBUG (Thread-3) [miio.device] 10.10.0.16:54321 >>: {'method': 'get_status', 'id': 203}
2017-12-09 16:06:54 ERROR (Thread-3) [miio.device] Got error when receiving: timed out
2017-12-09 16:06:54 WARNING (Thread-3) [miio.device] Retrying with incremented id, retries left: 1
2017-12-09 16:06:55 DEBUG (Thread-3) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2017-12-09 16:06:55 DEBUG (Thread-3) [miio.device] Got a response: Container:
data = Container:
offset1 = 32
offset2 = 32
length = 0
data = (total 0)
value = (total 0)
header = Container:
offset1 = 0
offset2 = 16
length = 16
data = !1\x00 \x00\x00\x00\x00\x03\xd7\xe6(Z+\xfc\r (total 16)
value = Container:
length = 32
unknown = 0
devtype = default (total 7)
serial = 58920
ts = 2017-12-09 15:06:53
checksum = \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff (total 16)
2017-12-09 16:06:55 DEBUG (Thread-3) [miio.device] Discovered default 58920 with ts: 2017-12-09 15:06:53, token: b'ffffffffffffffffffffffffffffffff'
2017-12-09 16:06:55 DEBUG (Thread-3) [miio.device] 10.10.0.16:54321 >>: {'method': 'get_status', 'id': 304}
2017-12-09 16:07:20 DEBUG (Thread-4) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2017-12-09 16:07:20 DEBUG (Thread-4) [miio.device] Got a response: Container:
data = Container:
offset1 = 32
offset2 = 32
length = 0
data = (total 0)
value = (total 0)
header = Container:
offset1 = 0
offset2 = 16
length = 16
data = !1\x00 \x00\x00\x00\x00\x03\xd7\xe6(Z+\xfc' (total 16)
value = Container:
length = 32
unknown = 0
devtype = default (total 7)
serial = 58920
ts = 2017-12-09 15:07:19
checksum = \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff (total 16)
2017-12-09 16:07:20 DEBUG (Thread-4) [miio.device] Discovered default 58920 with ts: 2017-12-09 15:07:19, token: b'ffffffffffffffffffffffffffffffff'
2017-12-09 16:07:20 DEBUG (Thread-4) [miio.device] 10.10.0.16:54321 >>: {'method': 'get_status', 'id': 305}
2017-12-09 16:07:25 ERROR (Thread-4) [miio.device] Got error when receiving: timed out
2017-12-09 16:07:25 WARNING (Thread-4) [miio.device] Retrying with incremented id, retries left: 3
2017-12-09 16:07:26 DEBUG (Thread-4) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2017-12-09 16:07:26 DEBUG (Thread-4) [miio.device] Got a response: Container:
data = Container:
offset1 = 32
offset2 = 32
length = 0
data = (total 0)
value = (total 0)
header = Container:
offset1 = 0
offset2 = 16
length = 16
data = !1\x00 \x00\x00\x00\x00\x03\xd7\xe6(Z+\xfc, (total 16)
value = Container:
length = 32
unknown = 0
devtype = default (total 7)
serial = 58920
ts = 2017-12-09 15:07:24
checksum = \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff (total 16)
2017-12-09 16:07:26 DEBUG (Thread-4) [miio.device] Discovered default 58920 with ts: 2017-12-09 15:07:24, token: b'ffffffffffffffffffffffffffffffff'
2017-12-09 16:07:26 DEBUG (Thread-4) [miio.device] 10.10.0.16:54321 >>: {'method': 'get_status', 'id': 406}
2017-12-09 16:07:31 ERROR (Thread-4) [miio.device] Got error when receiving: timed out
2017-12-09 16:07:31 WARNING (Thread-4) [miio.device] Retrying with incremented id, retries left: 2
2017-12-09 16:07:31 DEBUG (Thread-4) [miio.protocol] Unable to decrypt, returning raw bytes: b''
2017-12-09 16:07:31 DEBUG (Thread-4) [miio.device] Got a response: Container:
data = Container:
offset1 = 32
offset2 = 32
length = 0
data = (total 0)
value = (total 0)
header = Container:
offset1 = 0
offset2 = 16
length = 16
data = !1\x00 \x00\x00\x00\x00\x03\xd7\xe6(Z+\xfc1 (total 16)
value = Container:
length = 32
unknown = 0
devtype = default (total 7)
serial = 58920
ts = 2017-12-09 15:07:29
checksum = \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff (total 16)
2017-12-09 16:07:31 DEBUG (Thread-4) [miio.device] 10.10.0.16:54321 >>: {'method': 'get_status', 'id': 507}
etc.
Additional info:
Me too, I switched from Hass.io to Hassbian, both with version 0.59 and after the switch the air purifier isn鈥檛 available any longer, the log shows:
```ERROR (Thread-10) [miio.device] Got error when receiving: timed out
WARNING (Thread-10) [miio.device] Retrying with incremented id, retries left: 3
WARNING (MainThread) [homeassistant.components.fan] Setup of platform xiaomi_miio is taking over 10 seconds.
ERROR (Thread-10) [miio.device] Got error when receiving: timed out
WARNING (Thread-10) [miio.device] Retrying with incremented id, retries left: 2
ERROR (Thread-10) [miio.device] Got error when receiving: timed out
WARNING (Thread-10) [miio.device] Retrying with incremented id, retries left: 1
ERROR (Thread-10) [miio.device] Got error when receiving: timed out
The configuration.yaml was not changed, it is:
configuration.yaml:
fan:
I'm trying to replicate the same issue as you guys have, but I don't get any issues with the vacuum itself, only the already documented error in log, which does not impact functionality of vacuum.
2017-12-07 20:04:57 ERROR (Thread-4) [miio.device] Unable to discover a device at address 192.168.2.198
2017-12-07 20:04:57 WARNING (Thread-4) [homeassistant.components.vacuum.xiaomi_miio] Got exception while fetching the state: Unable to discover the device 192.168.2.198
I'm on VirtEnv, 0.59.2, Python 3.5.3, same upgrade path as @meetyourlaser
pip3 freeze
result shows python-miio==0.3.2
, asyncio==3.4.3
.
Can you check if you get the same versions inside of your virtual environment ?
Ultimately I'd reset and reconnect the device and re-grab the token from the app to make sure its not token issue.
I checked and did not have asyncio installed at all, so I installed it. But still no luck, then I upgraded to 0.59.2 again. I also re-extracted the token and it did not change. So I have the exact same versions installed as you.
But funny now I remember that I got the same errors as you @ferdydek but nevertheless everything worked. But now the [miio.device] Unable to discover a device at address
error is away.
No asyncio here neither鈥擠o I need it? I鈥檝e also re-extracted the token, and there was no change. python-miio==0.3.2
Now I reset the air purifier and extracted the new token. Didn't do the trick for me, but now I get more errors again, the previous one and the one that did not influence functionality.
Got exception while fetching the state: Unable to discover the device 192.168.1.236
Unable to discover a device at address 192.168.1.236
WARNING (Thread-10) [miio.device] Retrying with incremented id, retries left: 3
WARNING (MainThread) [homeassistant.components.fan] Setup of platform xiaomi_miio is taking over 10 seconds.
ERROR (Thread-10) [miio.device] Got error when receiving: timed out
WARNING (Thread-10) [miio.device] Retrying with incremented id, retries left: 2
ERROR (Thread-10) [miio.device] Got error when receiving: timed out
WARNING (Thread-10) [miio.device] Retrying with incremented id, retries left: 1
ERROR (Thread-10) [miio.device] Got error when receiving: timed out
With the old SD Card it works, there I'm running Hass.io version 0.59.1
I'm having the same issue as LordTofu, with the same messages in the log however I am using the Xiaomi Philips bulb.
Edit: Was working without issue on 58.0, stopped working when upgrading to 59.2
I don't see anything in the changes made in https://github.com/home-assistant/home-assistant/pull/10839 latest release that could break the config you guys have.
We have basically the same setup, so lets compare Xiaomi versions. For me in working setup: MiHome 5.0.10, Mi Robot Vacuum firmware: 3.3.9_003077. Can you please compare yours.
Also, we are sure token didn't change in your case @LordTofu @meetyourlaser, what about the IP/host ? Can you make sure the IP is correct? Is the vacuum and HA on the same VLAN ?
@rytilahti do you think its the same as https://github.com/rytilahti/python-miio/issues/92 ?
With @arnie580 's comment it seems the entire miio platform is affected.
I get the same error on my hassbian installation after update to 0.59.2
2017-12-10 19:22:02 WARNING (MainThread) [homeassistant.components.vacuum] Updating xiaomi_miio vacuum took longer than the scheduled update interval 0:00:20
2017-12-10 19:22:02 ERROR (Thread-14) [miio.device] Got error when receiving: timed out
2017-12-10 19:22:02 WARNING (Thread-14) [homeassistant.components.vacuum.xiaomi_miio] Got exception while fetching the state:
2017-12-10 19:22:28 ERROR (Thread-18) [miio.device] Got error when receiving: timed out
2017-12-10 19:22:28 WARNING (Thread-18) [miio.device] Retrying with incremented id, retries left: 3
2017-12-10 19:22:33 ERROR (Thread-18) [miio.device] Got error when receiving: timed out
2017-12-10 19:22:33 WARNING (Thread-18) [miio.device] Retrying with incremented id, retries left: 2
2017-12-10 19:22:38 ERROR (Thread-18) [miio.device] Got error when receiving: timed out
2017-12-10 19:22:38 WARNING (Thread-18) [miio.device] Retrying with incremented id, retries left: 1
2017-12-10 19:22:43 ERROR (Thread-18) [miio.device] Got error when receiving: timed out
No the token did not change and the IP is static and still the same. Nothing on the router was changed. But now with Hass.io it works. Maybe the different python versions are the problem, Hass.io runs with 3.6 and Hassbian with 3.5?
@andersmbgt @niklaskemi same person ? :D
@LordTofu I have:
(homeassistant) homeassistant@MrMeeSeeks:/home/pi$ python3 -V
Python 3.5.3
(homeassistant) homeassistant@MrMeeSeeks:/home/pi$ pip3 --version
pip 9.0.1 from /srv/homeassistant/lib/python3.5/site-packages (python 3.5)
Yes for the Hassbian installation it's 3.5.3. But I don't know how to access python within the docker container...
I have the same problem after update 0.59.2. My old version was 0.58.1 and was works perfect. My ip is fixed.
@LordTofu @meetyourlaser @drivers1
Are you all on docker/hassio ?
@ferdydek I鈥檓 using Hassbian.
Same issue with my Airpurifier Pro.
I am also using Hassbian 0.59.2
I installed the python-miio in rpi3(not in Venv) and tested the below.
It looks python-miio is broken in somewhere.
pi@Tommy:/ $ mirobo --ip 192.168.0.15 --token 2a4d39a5721f983fdceae9193fc35596 -d info
INFO:miio.vacuum_cli:Debug mode active
ERROR:miio.vacuum_cli:Unable to read the stored msgid: [Errno 2] No such file or directory: '/tmp/python-mirobo.seq'
DEBUG:miio.vacuum_cli:Connecting to 192.168.0.15 with token 2a4d39a5721f983fdceae9193fc35596
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.device:Got a response: Container:
data = Container:
length = 0
offset2 = 32
data = (total 0)
offset1 = 32
value = (total 0)
header = Container:
length = 16
offset2 = 16
data = !1\x00 \x00\x00\x00\x00\x036}B\x00\x02l\x88 (total 16)
offset1 = 0
value = Container:
length = 32
unknown = 0
devtype = default (total 7)
serial = 32066
ts = 1970-01-02 20:07:36
checksum = *M9\xa5r\x1f\x98?\xdc\xea\xe9\x19?\xc3U\x96 (total 16)
DEBUG:miio.device:Discovered default 32066 with ts: 1970-01-02 20:07:36, token: b'2a4d39a5721f983fdceae9193fc35596'
DEBUG:miio.device:192.168.0.15:54321 >>: {'id': 1, 'params': [], 'method': 'miIO.info'}
ERROR:miio.device:Got error when receiving: timed out
WARNING:miio.device:Retrying with incremented id, retries left: 3
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.device:Got a response: Container:
data = Container:
length = 0
offset2 = 32
data = (total 0)
offset1 = 32
value = (total 0)
header = Container:
length = 16
offset2 = 16
data = !1\x00 \x00\x00\x00\x00\x036}B\x00\x02l\x8e (total 16)
offset1 = 0
value = Container:
length = 32
unknown = 0
devtype = default (total 7)
serial = 32066
ts = 1970-01-02 20:07:42
checksum = *M9\xa5r\x1f\x98?\xdc\xea\xe9\x19?\xc3U\x96 (total 16)
DEBUG:miio.device:Discovered default 32066 with ts: 1970-01-02 20:07:42, token: b'2a4d39a5721f983fdceae9193fc35596'
DEBUG:miio.device:192.168.0.15:54321 >>: {'id': 102, 'params': [], 'method': 'miIO.info'}
ERROR:miio.device:Got error when receiving: timed out
WARNING:miio.device:Retrying with incremented id, retries left: 2
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.device:Got a response: Container:
data = Container:
length = 0
offset2 = 32
data = (total 0)
offset1 = 32
value = (total 0)
header = Container:
length = 16
offset2 = 16
data = !1\x00 \x00\x00\x00\x00\x036}B\x00\x02l\x93 (total 16)
offset1 = 0
value = Container:
length = 32
unknown = 0
devtype = default (total 7)
serial = 32066
ts = 1970-01-02 20:07:47
checksum = *M9\xa5r\x1f\x98?\xdc\xea\xe9\x19?\xc3U\x96 (total 16)
DEBUG:miio.device:Discovered default 32066 with ts: 1970-01-02 20:07:47, token: b'2a4d39a5721f983fdceae9193fc35596'
DEBUG:miio.device:192.168.0.15:54321 >>: {'id': 203, 'params': [], 'method': 'miIO.info'}
ERROR:miio.device:Got error when receiving: timed out
WARNING:miio.device:Retrying with incremented id, retries left: 1
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.device:Got a response: Container:
data = Container:
length = 0
offset2 = 32
data = (total 0)
offset1 = 32
value = (total 0)
header = Container:
length = 16
offset2 = 16
data = !1\x00 \x00\x00\x00\x00\x036}B\x00\x02l\x98 (total 16)
offset1 = 0
value = Container:
length = 32
unknown = 0
devtype = default (total 7)
serial = 32066
ts = 1970-01-02 20:07:52
checksum = *M9\xa5r\x1f\x98?\xdc\xea\xe9\x19?\xc3U\x96 (total 16)
DEBUG:miio.device:Discovered default 32066 with ts: 1970-01-02 20:07:52, token: b'2a4d39a5721f983fdceae9193fc35596'
DEBUG:miio.device:192.168.0.15:54321 >>: {'id': 304, 'params': [], 'method': 'miIO.info'}
ERROR:miio.device:Got error when receiving: timed out
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 236, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 236, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 236, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 236, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/mirobo", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/miio/vacuum_cli.py", line 395, in info
res = vac.info()
File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 274, in info
return DeviceInfo(self.send("miIO.info", []))
File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 258, in send
return self.send(command, parameters, retry_count - 1)
File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 258, in send
return self.send(command, parameters, retry_count - 1)
File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 258, in send
return self.send(command, parameters, retry_count - 1)
File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 259, in send
raise DeviceException from ex
miio.device.DeviceException
But it's the same python-miio version as in Hass.io and there it works... :/
I鈥檓 using Hassbian too.
@af950833 please format the code! :) Also, can you again try mirobo command with -dd
instead of -d
? And please format the code of use hastebin to show the log result.
I'm still trying to figure out what is in 0.59.2 that is not in 0.58.x ... because for me it still works and for you guys it doesn't. Guess we need to wait for @rytilahti .
same problem with hassbian 0.59 and python-miio 0.3.2
Same issue here. Currently home so can do some tests...
here is an extract from my debug log:
2017-12-11 13:21:47 DEBUG (Thread-2) [miio.device] Got a response: Container:
data = Container:
offset1 = 32
value = (total 0)
length = 0
offset2 = 32
data = (total 0)
header = Container:
offset1 = 0
value = Container:
length = 32
unknown = 0
devtype = default (total 7)
serial = 55578
ts = 2017-12-11 13:21:47
length = 16
offset2 = 16
data = !1\x00 \x00\x00\x00\x00\x03\[edited]\xd9\x1aZ.\x86k (total 16)
checksum = \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff (total 16)
2017-12-11 13:21:48 DEBUG (Thread-2) [miio.device] Discovered default 55578 with ts: 2017-12-11 13:21:47, token: b'ffffffffffffffffffffffffffffffff'
2017-12-11 13:21:48 DEBUG (Thread-2) [miio.device] 192.168.0.18:54321 >>: {'id': 1, 'method': 'get_status'}
2017-12-11 13:21:53 ERROR (Thread-2) [miio.device] Got error when receiving: timed out
2017-12-11 13:21:53 WARNING (Thread-2) [miio.device] Retrying with incremented id, retries left: 3
@ferdydek
I have the same firmware versions as you: 3.3.9_003077, but my MiHome version is different: 4.3.2 (updated on 5th Dec, I'm on iPhone, is this why?)
I've gone through an iTunes backup to retrieve the token and it's 100% the same.
I'm on a Ubuntu install (not hassbian, not docker, no venv)
My pip3 is the same version by my python3 is 3.5.2
Now for sure, the problem is related to the version of python, I went to check the relevant code to se
@roiff so what version do we need?
@LordTofu
Not applicable to HA
Directly using python-miio plug-in for testing
python3.5
miio 0.3.2
unsuccessful
python3.5
miio 0.3.0
unsuccessful
python3.6
miio 0.3.2
success
I am also looking for reasons now
please wait
Everyone uses raspberry pie, and the system is a X64 stretch system?
@roiff
I'm not on a raspberry pi, I use Ubuntu 16.04 64bit
your python version?
@lolouk44
@ferdydek Because I am not a native speaker, I can't understand what you mean. (Format code? hastebin?)
Anyway, I uninstalled the python-miio and then reinstall it.
I tried the command with -dd as you said.
The below is the result.
pi@Tommy:~ $ mirobo --ip 192.168.0.15 --token 2a4d39a5721f983fdceae9193fc35596 -dd info
INFO:miio.vacuum_cli:Debug mode active
ERROR:miio.vacuum_cli:Unable to read the stored msgid: [Errno 2] No such file or directory: '/tmp/python-mirobo.seq'
DEBUG:miio.vacuum_cli:Connecting to 192.168.0.15 with token 2a4d39a5721f983fdceae9193fc35596
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.device:Got a response: Container:
data = Container:
value = (total 0)
offset2 = 32
length = 0
data = (total 0)
offset1 = 32
header = Container:
value = Container:
length = 32
unknown = 0
devtype = default (total 7)
serial = 32066
ts = 1970-01-03 04:25:36
offset2 = 16
length = 16
data = !1\x00 \x00\x00\x00\x00\x036}B\x00\x02\xe1@ (total 16)
offset1 = 0
checksum = *M9\xa5r\x1f\x98?\xdc\xea\xe9\x19?\xc3U\x96 (total 16)
DEBUG:miio.device:Container:
data = Container:
value = (total 0)
offset2 = 32
length = 0
data = (total 0)
offset1 = 32
header = Container:
value = Container:
length = 32
unknown = 0
devtype = default (total 7)
serial = 32066
ts = 1970-01-03 04:25:36
offset2 = 16
length = 16
data = !1\x00 \x00\x00\x00\x00\x036}B\x00\x02\xe1@ (total 16)
offset1 = 0
checksum = *M9\xa5r\x1f\x98?\xdc\xea\xe9\x19?\xc3U\x96 (total 16)
DEBUG:miio.device:Discovered default 32066 with ts: 1970-01-03 04:25:36, token: b'2a4d39a5721f983fdceae9193fc35596'
DEBUG:miio.device:192.168.0.15:54321 >>: {'id': 1, 'params': [], 'method': 'miIO.info'}
Traceback (most recent call last):
File "/usr/local/bin/mirobo", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/miio/vacuum_cli.py", line 395, in info
res = vac.info()
File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 274, in info
return DeviceInfo(self.send("miIO.info", []))
File "/usr/local/lib/python3.5/dist-packages/miio/device.py", line 224, in send
self._timeout, Message.parse(m, ctx))
File "/usr/local/lib/python3.5/dist-packages/construct/core.py", line 158, in parse
return self.parse_stream(BytesIO(data), context, **kw)
File "/usr/local/lib/python3.5/dist-packages/construct/core.py", line 171, in parse_stream
return self._parse(stream, context2, "(parsing)")
File "/usr/local/lib/python3.5/dist-packages/construct/core.py", line 863, in _parse
subobj = sc._parse(stream, context, path)
File "/usr/local/lib/python3.5/dist-packages/construct/core.py", line 2780, in _parse
return self.subcon._parse(stream, context, path)
File "/usr/local/lib/python3.5/dist-packages/construct/core.py", line 2205, in _parse
obj = self.subcon._parse(stream, context, path)
File "/usr/local/lib/python3.5/dist-packages/construct/core.py", line 863, in _parse
subobj = sc._parse(stream, context, path)
File "/usr/local/lib/python3.5/dist-packages/construct/core.py", line 2780, in _parse
return self.subcon._parse(stream, context, path)
File "/usr/local/lib/python3.5/dist-packages/construct/core.py", line 311, in _parse
return self._decode(self.subcon._parse(stream, context, path), context)
File "/usr/local/lib/python3.5/dist-packages/miio/protocol.py", line 148, in _decode
return datetime.datetime.utcfromtimestamp(obj)
OverflowError: timestamp out of range for platform time_t
pi@Tommy:~ $
I also tried to downgrade to 0.58.0 (I am using Hassbain).
The result is same. miio device is not available with old version.
Most of people met this issue with upgrade of HA and I met it with reinstall the Hassbian.
If you do a downgrade or reinstall HA, you may also meet this issue.
@roiff
Python 3.5.2
@af950833 I experienced the same issue after downgrading to 0.58.1 which used to work pre-upgrade
I installed Hass.io and it works well.
My airpurifier is available now.
I am going to reinstall Hassbian again.
@af950833 I just meant that your should use formatting https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
Since at least 2 people say downgrading HA itself to previous release does not solve the issue, I suspect its something to do with OS/Python/pip or other libraries that has collision with miio, anyone has any idea how to further troubleshoot it ?
https://pypi.python.org/pypi/construct/
I think this December 8 update dependency should be the main issue
So i am seeing this issue. I run in a venv from pip3.
If I run mirobo discover, I find the 3 supported vacuums.
I've confirmed the tokens have not changed, and the mi home app can control them.
If I run a 'find':
$ mirobo --ip 10.255.254.105 --token XXXXXXXXXXXXXXXX find
ERROR:miio.vacuum_cli:Unable to read the stored msgid: [Errno 2] No such file or directory: '/tmp/python-mirobo.seq'
Sending find the robot calls.
ERROR:miio.device:Got error when receiving: timed out
WARNING:miio.device:Retrying with incremented id, retries left: 3
ERROR:miio.device:Got error when receiving: timed out
WARNING:miio.device:Retrying with incremented id, retries left: 2
WARNING:miio.device:Retrying with incremented id, retries left: 1
ERROR:miio.device:Got error when receiving: timed out
Traceback (most recent call last):
File "/home/homeassistant/lib/python3.5/site-packages/miio/device.py", line 236, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
$ mirobo -dd --ip 10.255.254.105 --token XXXXXXXXXXXXXXXX home
INFO:miio.vacuum_cli:Debug mode active
ERROR:miio.vacuum_cli:Unable to read the stored msgid: [Errno 2] No such file or directory: '/tmp/python-mirobo.seq'
DEBUG:miio.vacuum_cli:Connecting to 10.255.254.105 with token XXXXXXXXXXXXXXXX
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.device:Got a response: Container:
data = Container:
offset1 = 32
value = (total 0)
length = 0
offset2 = 32
data = (total 0)
header = Container:
offset1 = 0
value = Container:
length = 32
unknown = 0
devtype = default (total 7)
serial = 59443
ts = 2017-12-11 16:59:33
length = 16
offset2 = 16
data = !1\x00 \x00\x00\x00\x00\x03\xd9\xe83Z.\xb9u (total 16)
checksum = \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff (total 16)
DEBUG:miio.device:Container:
data = Container:
offset1 = 32
value = (total 0)
length = 0
offset2 = 32
data = (total 0)
header = Container:
offset1 = 0
value = Container:
length = 32
unknown = 0
devtype = default (total 7)
serial = 59443
ts = 2017-12-11 16:59:33
length = 16
offset2 = 16
data = !1\x00 \x00\x00\x00\x00\x03\xd9\xe83Z.\xb9u (total 16)
checksum = \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff (total 16)
DEBUG:miio.device:Discovered default 59443 with ts: 2017-12-11 16:59:33, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.device:10.255.254.105:54321 >>: {'id': 1, 'method': 'app_stop'}
Traceback (most recent call last):
File "/home/homeassistant/lib/python3.5/site-packages/construct/core.py", line 2780, in _parse
return self.subcon._parse(stream, context, path)
File "/home/homeassistant/lib/python3.5/site-packages/construct/core.py", line 1591, in _parse
obj = self.cases.get(key, self.default)._parse(stream, context, path)
File "/home/homeassistant/lib/python3.5/site-packages/construct/core.py", line 2342, in _parse
hash2 if not isinstance(hash2,bytes) else hexlify(hash2), ))
construct.core.ChecksumError: wrong checksum, read b'ea7bc45e394600da1ecd3df950e60000', computed b'0f0e613bc9cbe77098b9fded4edabe2e'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/homeassistant/bin/mirobo", line 11, in <module>
sys.exit(cli())
File "/home/homeassistant/lib/python3.5/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/home/homeassistant/lib/python3.5/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/homeassistant/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/homeassistant/lib/python3.5/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/homeassistant/lib/python3.5/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/homeassistant/lib/python3.5/site-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "/home/homeassistant/lib/python3.5/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/homeassistant/lib/python3.5/site-packages/miio/vacuum_cli.py", line 207, in home
click.echo("Requesting return to home: %s" % vac.home())
File "/home/homeassistant/lib/python3.5/site-packages/miio/vacuum.py", line 58, in home
self.send("app_stop")
File "/home/homeassistant/lib/python3.5/site-packages/miio/device.py", line 224, in send
self._timeout, Message.parse(m, ctx))
File "/home/homeassistant/lib/python3.5/site-packages/construct/core.py", line 158, in parse
return self.parse_stream(BytesIO(data), context, **kw)
File "/home/homeassistant/lib/python3.5/site-packages/construct/core.py", line 171, in parse_stream
return self._parse(stream, context2, "(parsing)")
File "/home/homeassistant/lib/python3.5/site-packages/construct/core.py", line 863, in _parse
subobj = sc._parse(stream, context, path)
File "/home/homeassistant/lib/python3.5/site-packages/construct/core.py", line 2784, in _parse
raise e.__class__("%s\n %s" % (e, path))
construct.core.ChecksumError: wrong checksum, read b'ea7bc45e394600da1ecd3df950e60000', computed b'0f0e613bc9cbe77098b9fded4edabe2e'
(parsing) -> checksum
Installed I have:
$ pip3 list installed --format=columns
Package Version
----------------------- -----------
aiohttp 2.3.6
aiohttp-cors 0.5.3
android-backup 0.1.0
apcaccess 0.0.13
appdirs 1.4.3
asn1crypto 0.23.0
astral 1.4
async-timeout 2.0.0
attrs 17.3.0
bellows 0.4.0
certifi 2017.11.5
cffi 1.11.2
chardet 3.0.4
click 6.7
click-log 0.2.1
colorlog 3.1.0
construct 2.8.17
cookies 2.2.1
crccheck 0.6
cryptography 2.1.4
denonavr 0.5.4
distro 1.1.0
ecdsa 0.13
enum-compat 0.0.2
flake8 3.5.0
future 0.16.0
fuzzywuzzy 0.15.1
gTTS-token 1.1.1
home-assistant-frontend 20171204.0
homeassistant 0.59.2
http-ece 1.0.5
idna 2.6
Jinja2 2.10
MarkupSafe 1.0
mccabe 0.6.1
miniupnpc 2.0.2
multidict 3.3.2
mutagen 1.39
mysqlclient 1.3.12
netdisco 1.2.3
netifaces 0.10.6
packaging 16.8
paho-mqtt 1.3.1
pip 9.0.1
pkg-resources 0.0.0
PlexAPI 3.0.3
pretty-cron 1.0.2
protobuf 3.5.0.post1
pure-pcapy3 1.0.1
py-cpuinfo 3.3.0
py-vapid 1.3.0
pyasn1 0.4.2
PyChromecast 0.8.2
pycodestyle 2.3.1
pycparser 2.18
pycrypto 2.6.1
PyDispatcher 2.0.5
pyelliptic 1.5.8
pyflakes 1.6.0
pyfttt 0.3
pyharmony 1.0.18
PyJWT 1.5.3
pyowm 2.7.1
pyparsing 2.2.0
pyserial 3.4
pyserial-asyncio 0.4
python-dateutil 2.6.1
python-ecobee-api 0.0.12
python-forecastio 1.3.5
python-jose 1.4.0
python-miio 0.3.2
python-mirobo 0.2.0
python-nest 3.1.0
python-nmap 0.6.1
python-openzwave 0.4.0.35
pytz 2017.3
pywebpush 1.3.0
PyXiaomiGateway 0.6.0
PyYAML 3.12
requests 2.18.4
responses 0.8.1
roku 2.0
samsungctl 0.6.0
setuptools 38.2.4
six 1.11.0
sleekxmpp 1.3.3
soco 0.12
SQLAlchemy 1.1.15
tqdm 4.19.5
typing 3.6.2
ua-parser 0.7.3
urllib3 1.22
user-agents 1.1.0
voluptuous 0.10.5
wakeonlan 0.2.2
websocket-client 0.44.0
wheel 0.30.0
xmltodict 0.11.0
yarl 0.16.0
zeroconf 0.19.1
Its running
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
on Ubuntu 16.04
construct Return to 2.8.16
The problem is solved
pip3 install construct==2.8.16
I tried reimaged SD with Hassbian.
It is also not available at HA 0.59.2 and python 3.53
I tried to upgrade python to 3.6.0 in the Hassbain ( Referred to https://github.com/home-assistant/home-assistant/issues/8342#issuecomment-326918777).
It is not available yet with python 3.6.0
Currently, Hass.io is a only solution.
@af950833 The problem is solved
@roiff You are a genius!!! I checked your solution and it works well.
I really thank you!!!!
@roiff yes it works now, how did you find out?
Thanks can be closed I guess?
@LordTofu debug some codes
@LordTofu @roiff how long before HA connected to your vacuum? installed the v2.8.16 of construct but it still fails to connect...
@lolouk44 immediately
if in Virtual environment
you can
sudo systemctl stop [email protected]
sudo su -s /bin/bash homeassistant
source /srv/homeassistant/bin/activate
pip3 install construct==2.8.16
exit
sudo systemctl start [email protected]
and so on
@lolouk44 almost immediately after restarting the service.
@roiff
I might have a slightly different issue then...
I have installed the right version of construct, but I had to use sudo as my user did not have the rights to install it. (I don't have a homeassistant user, everything is ran from my user).
Install went correctly as if I try again I get this:
Requirement already satisfied: construct==2.8.16 in usr/local/lib/python3.5/dist-packages
I even tried to install it with pip instead of pip3 in case I missed something,
I'll grab some logs in debug mode.
In the meantime any idea what I could try/test?
@lolouk44
easy to test
run python3
import miio
a = miio.airhumidifier.AirHumidifier('192.168.1.xxx','ffffffffffffffffffffffffffffffff')
a.info()
Do not care about the type of equipment, as a test, are the same, instead of your ip and token
you can get some state
if errror you can get error info
@roiff
Do I need to install miio separately?
Running the above tells me No module named 'miio'
EDIT:
copied the script in .homeassistantdepslibpython3.5site-packages
here is the output:
cctv@HP-N54L:~/.homeassistant/deps/lib/python3.5/site-packages$ python3 test.py Got error when receiving: timed out
Retrying with incremented id, retries left: 3
Got error when receiving: timed out
Retrying with incremented id, retries left: 2
Got error when receiving: timed out
Retrying with incremented id, retries left: 1
Got error when receiving: timed out
Traceback (most recent call last):
File "/home/cctv/.homeassistant/deps/lib/python3.5/site-packages/miio/device.py", line 236, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/cctv/.homeassistant/deps/lib/python3.5/site-packages/miio/device.py", line 236, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/cctv/.homeassistant/deps/lib/python3.5/site-packages/miio/device.py", line 236, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/cctv/.homeassistant/deps/lib/python3.5/site-packages/miio/device.py", line 236, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "test.py", line 3, in <module>
a.info()
File "/home/cctv/.homeassistant/deps/lib/python3.5/site-packages/miio/device.py", line 274, in info
return DeviceInfo(self.send("miIO.info", []))
File "/home/cctv/.homeassistant/deps/lib/python3.5/site-packages/miio/device.py", line 258, in send
return self.send(command, parameters, retry_count - 1)
File "/home/cctv/.homeassistant/deps/lib/python3.5/site-packages/miio/device.py", line 258, in send
return self.send(command, parameters, retry_count - 1)
File "/home/cctv/.homeassistant/deps/lib/python3.5/site-packages/miio/device.py", line 258, in send
return self.send(command, parameters, retry_count - 1)
File "/home/cctv/.homeassistant/deps/lib/python3.5/site-packages/miio/device.py", line 259, in send
raise DeviceException from ex
miio.device.DeviceException
For me it works with the vacuum still with 2.8.17, but fails on the plug. I bisected the commit breaking it to https://github.com/construct/construct/commit/3c6714d22a55656e265a8d4cd43e6aaeab4c7641 . Now it will require to find out where is the best place to fix it.
For a temporary fix one can replace:
"devtype" / Enum(Default(Int16ub, 0x02f2),
default=Pass, **xiaomi_devices),
in miio/protocol.py
with:
"devtype" / Int16ub
I will fix the issue and release a new version of python-miio soonish though.
hi @rytilahti ,
I replaced the 2 lines with the single line like you said (though I kept a coma), and can confirm it works, thanks :)
As with lolouk44, replacing the 2 lines has fixed the issue for me with the Philips bulbs.
Same here. Replacing these to lines in : /srv/homeassistant/lib/python3.5/site-packages/miio/protocol.py
(hot)fix the problem.
Tks all, replacing the 2 lines has fixed the issue for me with the Philips bulbs
Same issue on 0.60 as well
issue with construct 2.8.17. temporarily downgrade to construct 2.8.16:
pip3 install --upgrade construct==2.8.16
Does anyone have an idea how to handle this problem using HASS on QNAP container?
Where do i find the file to edit in mac os??
I have Python 3.6 and under the sitepackages folder, i don't see a miio folder or protocol.py file? Should I look somewhere else?
Are you install python-miio v0.3.2 and construct v2.8.17?
I also have this bug and can confirm downgrading construct to 2.8.16 fixes it. But HA keeps upgrading it to 2.8.17, any idea how I can prevent this?
The proper fix is to depend on python-miio's version 0.3.3, this can be done by changing the beginning of vacuum/xiaomi_miio.py
or manually installing the newer version with pip (assuming you are using a virtualenv where it's stored, homeassistant does not do downgrades afaik?).
@rytilahti Well for a bugfix it can be downgraded (like was done with pychromecast), but since its basically fixed we just need to wait for the new release, right?
I installed construct v2.8.17 and python-miio v0.3.2, then replaced the 2 lines has fixed the issue for me with the Philips bulbs and Philips EyeCare.
But issue with python-miio v0.3.3.
WARNING (MainThread) [homeassistant.components.light] Platform xiaomi_miio not ready yet. Retrying in 30 seconds. Any Help? Thanks
construct.core.ChecksumError: wrong checksum, read b'ffffffffffffffffffffffffffffffff', computed b'8a2127c94e29f88e734263f8cacc2cd4'
(parsing) -> checksum
Failed to connect to bulb 192.168.187.112, Living Room Center: A socket error occurred when sending the command.
pip3 install construct==2.8.17
Replace:
"devtype" / Enum(Default(Int16ub, 0x02f2),
default=Pass, **xiaomi_devices),
in /srv/homeassistant/lib/python3.5/site-packages/miio/protocol.py with:
"devtype" / Int16ub
I am having the same issue in Home Assistant 60.1, still shown as Unavailable and I can see timeouts when trying to connect to it all over the logs.
When will the fix that is shown in this thread be added to HA?
I cannot make this fix easily myself as I have mine running in a Docker container.
@roiff you da man!!!
I had same issue on hass v.0.60.1 (manual install on Raspbian) in virtualenv.
Had to downgrade construction to 2.8.16 and things started working instantly.
This is on mirobot firmware v.3.3.8_003094
According to #11232 the fix (for broken connectivity with construct 2.8.17) will be in 0.61.
I've just updated to 0.61.0.dev0 to try this fix but it hasn't worked - I haven't tried the manual fixes suggested yet. Has anyone had luck with only the python-miio version update? Or will I likely have to make the protocol.py change?
I'm running construct 2.8.17 and python-miio 0.3.3 for some time without problems.
Just following up on this - my issue ended up being a changed API key. I extracted it the same way from iOS. No idea what has caused this, hopefully it's not a regular occurance with the app... No other changes for it to be working well with the 0.61.0 release.
I updated to 0.61.1, but the issue persists for me. I still have the same messages in my log. As reported earlier, the vacuum cleaner still respones to actual commands. Is there anybody else having these messages still?
I might try to check my API key again as @mynameisdaniel32 reported.
@TribuneX This issue is for situation where the vacuum does NOT work from HA anymore and seeds the construct related errors.
pip3 install construct==2.8.17
Replace:
"devtype" / Enum(Default(Int16ub, 0x02f2),
default=Pass, **xiaomi_devices),
in /srv/homeassistant/lib/python3.5/site-packages/miio/protocol.py with:
"devtype" / Int16ub,
There should be a commas at the end of this line. (Tested: fix Xiaomi Philips Smart LED Ball
)
Works for me again as Docker image with v0.63 on my Synology NAS
@meetyourlaser can you please test on latest build and close the issue. Thanks!
Works in Home Assistant 0.63.3!
Sadly, this issue still occurs on 0.65.4 :(
No luck with 0.65.6 too...
@DeanNotDin @linuxlurak
The issue described in the begging of this issue with construct is solved. What is not working in your case? can you please provide debug error logs?
Thanks for asking and being interested in this problem!
my logs tell me:
Mar 23 22:07:56 homeautomation hass[13435]: WARNING:homeassistant.components.vacuum.xiaomi_miio:Got exception while fetching the state: No response from the device
Mar 23 22:08:02 homeautomation hass[13435]: ERROR:miio.device:Got error when receiving: timed out
Mar 23 22:08:12 homeautomation hass[13435]: message repeated 2 times: [ ERROR:miio.device:Got error when receiving: timed out]
Mar 23 22:08:17 homeautomation hass[13435]: ERROR:miio.device:Unable to discover a device at address 192.168.10.7
Mar 23 22:08:17 homeautomation hass[13435]: WARNING:homeassistant.components.vacuum.xiaomi_miio:Got exception while fetching the state: Unable to discover the device 192.168.10.7
My robovac is not available:
mirobo finds my robovac.
Can you enable debug logging (by adding in logger:
section of configuration.yaml
logs:
homeassistant.components.vacuum.xiaomi_miio: debug
and restarting HA ?
If its the same construct problem this issue is about then you should see something like [...] [miio.protocol] Unable to decrypt, returning raw bytes [...]
in your logs.
What installation type is this? VirtEnv? Hassio? Can you log in to the OS and run pip3 freeze
so we know which versions the components use?
installed hass with pip3 on my ubuntu machine (details below).
log is already set to debug.
System:
Distributor ID: Ubuntu
Description: Ubuntu 17.10
Release: 17.10
Codename: artful
Linux homeautomation 4.13.0-36-generic #40-Ubuntu SMP Fri Feb 16 20:07:48 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
pip3 freeze:
aiohttp==3.0.6
android-backup==0.1.0
appdirs==1.4.3
asn1crypto==0.24.0
astral==1.5
async-timeout==2.0.0
attrs==17.4.0
bluepy==1.1.4
certifi==2018.1.18
cffi==1.11.5
chardet==3.0.4
click==6.7
construct==2.9.31
cryptography==2.2.1
distro-info==0.17
enum-compat==0.0.2
first==2.0.1
homeassistant==0.65.6
idna==2.6
idna-ssl==1.0.1
Jinja2==2.10
MarkupSafe==1.0
multidict==4.1.0
netifaces==0.10.6
paho-mqtt==1.3.1
pip-tools==1.11.0
pretty-cron==1.0.2
pycparser==2.18
pycrypto==2.6.1
python-apt==1.4.0b3
python-miio==0.3.8
pytz==2018.3
PyYAML==3.12
requests==2.18.4
six==1.11.0
SQLAlchemy==1.2.5
tqdm==4.19.8
typing==3.6.4
urllib3==1.22
voluptuous==0.11.1
websockets==4.0.1
yarl==1.1.1
zeroconf==0.20.0
"mirobo --ip 192.168.10.7 --token [cut out ] -dd info" gives me:
INFO:miio.vacuum_cli:Debug mode active
DEBUG:miio.vacuum_cli:Connecting to 192.168.10.7 with token [cut out]
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.device:Got a response: Container:
...
tried to downgrade to construct==2.8.16, still not available.
"devtype" non existent in ../miio/protocol.py...
I have the same construct==2.9.31
. Are you sure this pip is run in the same (virtual) environment as HA ?
I have lower version than you on python-miio==0.3.7
tho. Cant tell without digging into the code if that can be the cause.
[edit]
actually I have a lot of version different than you, you have been tinkering with the setup a bit too much I guess and mixed HA's environment with other things you're running there?
Yes, there is only one environment (same for root as for user "homeassistant", tested with logged in user an pip3 freeze which gives the same packages).
I upgraded every packages installed to see if it resolves the problem, that's probably why I have a lot of other versions.
I removed all packages installed by pip3:
pip freeze | xargs pip uninstall -y
then reinstalled hass:
pip3 install homeassistant --upgrade
Some packages were missing that I had to reinstall. Home Assistant won't install those packages automatically it seems.
pip3 install python-miio python_openzwave paho-mqtt
Installed packages were:
aiohttp==3.0.6 android-backup==0.1.0 appdirs==1.4.3 asn1crypto==0.24.0 astral==1.5 async-timeout==2.0.0 attrs==17.4.0 certifi==2018.1.18 cffi==1.11.5 chardet==3.0.4 click==6.7 construct==2.9.31 cryptography==2.2.1 homeassistant==0.65.6 idna==2.6 idna-ssl==1.0.1 Jinja2==2.10 MarkupSafe==1.0 multidict==4.1.0 netdisco==1.3.1 netifaces==0.10.6 paho-mqtt==1.3.1 pretty-cron==1.0.2 pycparser==2.18 PyDispatcher==2.0.5 python-miio==0.3.8 python-openzwave==0.4.4 pytz==2018.3 PyYAML==3.12 requests==2.18.4 six==1.11.0 tqdm==4.19.8 typing==3.6.4 urllib3==1.22 voluptuous==0.11.1 yarl==1.1.1 zeroconf==0.20.0
I did the same (uninstall & install routine as above) with hass 0.65.0 and now have installed the same packages on my system.
@ferdydek could you post your pip3 requirements list? then I install the same packages on my system.
log spits out the same messages:
Mar 24 09:02:51 homeautomation hass[2463]: INFO:homeassistant.components.vacuum.xiaomi_miio:Initializing with host 192.168.10.7 (token []...)
Mar 24 09:02:57 homeautomation hass[2463]: ERROR:miio.device:Got error when receiving: timed out
Mar 24 09:03:12 homeautomation hass[2463]: message repeated 3 times: [ ERROR:miio.device:Got error when receiving: timed out]
Mar 24 09:03:12 homeautomation hass[2463]: WARNING:homeassistant.components.vacuum.xiaomi_miio:Got exception while fetching the state: No response from the device
mirobo discovers my robovac ("mirobo ... info"):
DEBUG:miio.device:Discovered 03db4a1b with ts: 1970-01-01 12:18:05, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.device:192.168.10.7:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
but "mirobo... start" won't start:
DEBUG:miio.device:Discovered 03db4a1b with ts: 1970-01-01 12:19:49, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.device:192.168.10.7:54321 >>: {'id': 1, 'method': 'app_start'}
DEBUG:miio.device:Retrying with incremented id, retries left: 3
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.device:Got a response: Container:
Stupid me. Sorry for all the fuzz!
I checked if the robovac was blocked by my pi hole... And it was! I forgot that I tested it (!).
So do not block
ot.io.mi.com
ott.io.mi.com
Just reject all traffic of your robovac except of DNS over UDP (and most likely NTP).
You most likely have this problem if your robovac is detected but does not respond to your commands.
Glad its solved, anyway you would be much better off if you would create py virtual environment for each service you run there (https://home-assistant.io/docs/installation/virtualenv/). Saves a lot of time in case of troubleshooting.
I'm locking discussion in this issue as the original problem has been solved already, and this is a bug tracker and not a forum :-)
Those who are affected by this are either:
1) Running an incompatible version of construct, in which case there are clues in the stacktrace pointing towards that direction, or
2) Blocking internet connectivity for the vacuum (shows in timeout warnings in the log). Two solutions have been presented to alleviate issues raising from this; either allow (at least) DNS through, and/or block using reject instead of drop in your firewall settings.
3) Using invalid token, which also will cause timeouts, so please verify your token.
Most helpful comment
construct Return to 2.8.16
The problem is solved