Core: Xiaomi Vacuum Cleaner robot timeout / unavailable

Created on 16 Aug 2017  路  59Comments  路  Source: home-assistant/core

Home Assistant release (hass --version):
0.51.2

Python release (python3 --version):
3.4.2

Component/platform:
vacuum

Description of problem:
I see that #8982 was closed @azogue but I am afraid I still have the same problem. The token is correct and mirobo can communicate without problems, all the times I have tried. As you can see it spawns those errors for more than 20 minutes.
2017-08-16 17:41:56 ERROR (Thread-10) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:41:56 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:42:17 ERROR (Thread-3) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:42:17 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:42:38 ERROR (Thread-6) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:42:38 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:42:59 ERROR (Thread-6) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:42:59 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:43:20 ERROR (Thread-5) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:43:20 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:43:41 ERROR (Thread-2) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:43:41 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:44:02 ERROR (Thread-2) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:44:02 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:44:23 ERROR (Thread-3) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:44:23 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:44:44 ERROR (Thread-10) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:44:44 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:45:05 ERROR (Thread-10) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:45:05 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:45:26 ERROR (Thread-11) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:45:26 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:45:30 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.vindruva_moisture is taking over 10 seconds 2017-08-16 17:45:47 ERROR (Thread-11) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:45:47 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:46:08 ERROR (Thread-11) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:46:08 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:46:29 ERROR (Thread-6) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:46:29 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:46:50 ERROR (Thread-3) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:46:50 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:47:11 ERROR (Thread-3) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:47:11 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:47:32 ERROR (Thread-3) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:47:32 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:47:53 ERROR (Thread-8) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:47:53 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:48:14 ERROR (Thread-7) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:48:14 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:48:35 ERROR (Thread-7) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:48:35 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:48:56 ERROR (Thread-2) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:48:56 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:49:17 ERROR (Thread-5) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:49:17 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:49:38 ERROR (Thread-11) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:49:38 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:49:59 ERROR (Thread-10) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:49:59 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:50:20 ERROR (Thread-3) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:50:20 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:50:41 ERROR (Thread-11) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:50:41 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:51:02 ERROR (Thread-8) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:51:02 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:51:23 ERROR (Thread-12) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:51:23 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:51:44 ERROR (Thread-3) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:51:44 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:52:05 ERROR (Thread-10) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:52:05 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:52:26 ERROR (Thread-12) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:52:26 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:52:47 ERROR (Thread-11) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:52:47 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:53:08 ERROR (Thread-3) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:53:08 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:53:29 ERROR (Thread-7) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:53:29 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:53:50 ERROR (Thread-12) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:53:50 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:54:11 ERROR (Thread-10) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:54:11 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:54:32 ERROR (Thread-4) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:54:32 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:54:53 ERROR (Thread-4) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:54:53 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:55:14 ERROR (Thread-11) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:55:14 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:55:35 ERROR (Thread-10) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:55:35 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:55:56 ERROR (Thread-8) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:55:56 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:56:17 ERROR (Thread-2) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:56:17 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:56:38 ERROR (Thread-3) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:56:38 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:57:20 ERROR (Thread-7) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:57:20 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:59:26 ERROR (Thread-4) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:59:26 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 17:59:47 ERROR (Thread-8) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 17:59:47 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 18:00:29 ERROR (Thread-7) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 18:00:29 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 18:02:13 ERROR (Thread-2) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 18:02:13 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128 2017-08-16 18:02:34 ERROR (Thread-5) [mirobo.device] Unable to discover a device at address 192.168.1.128 2017-08-16 18:02:34 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.128

waiting-for-reply

Most helpful comment

@danielpalstra your errors are not related to this issue. I guess the other issues were fixed with your update and you are left with the point 3 below. But this is not the issue for that problem.

I think we need to close this issue as it begins to suck up all possible issues with miio.
To close the topic @rytilahti correct me if Im wrong:

  1. The depreciated and discovery errors are now corrected (this is what this issue was created for with https://github.com/home-assistant/home-assistant/pull/10839).
  2. The updated library that broke the component at some point was fixed.
  3. The source of disconnects and timeouts is currently unknown and is investigated. Please don't add to this issue, create separate issue for that topic instead.

All 59 comments

I see, those are a lot of errors...

Well, for now there isn't a solution for lazy botvacs, and I think these problems have to be handled within the python-mirobo library, not in Home Assistant (what do you think about, @rytilahti ?), so perhaps opening an issue there is the way to go.

I'm understanding that you normally can access the bot and control it from HA, but sometimes you enter in that bad-update loop for quite some time, I'm correct, @olskar ?

I myself have some of these bad updates from time to time, but I chose to ignore them, because I hadn't the time to investigate and, anyway, in practice, they do not pose any problem to the botvac control...
The way to hide these is config the logger like that:

logger:
  default: warn
  logs:
    # Hide botvac connexion errors which happen sometimes:
    homeassistant.components.vacuum: error
    mirobo.device: critical

So you'll never see the messages, but that's obviously not a solution for the problem.

I could imagine some _sugar-code_ in the HA component to handle these without so many logging, remembering the last good update and so, but it would be just that, not a real solution whatsoever.
If that is wanted, I could do a PR about that this weekend...

Ok, I reopened it cause it seemed the person in the old issue resolved it by having the right token, but I got the same error even with the right token. If the error should be resolved in python-mirobo, I agree opening an issue there is the right way.

Do you know if this constant behavior might have a negative impact on performance in Home Assistant, or is it just cluttering the logs?

Do you know if this constant behavior might have a negative impact on performance in Home Assistant, or is it just cluttering the logs?

I think there is no real problem; if so, you could see some 'reset timer' in the logs or some side effects in cpu or memory usage, but it's not the case. That's why I chose to ignore them by now...

Same problem here.

For some reason the vacuum is not always responsive to the initial handshake, but the reason is not yet known. This may be, however, related to this problem: https://github.com/rytilahti/python-mirobo/issues/48

The same issue is discussed here I think: https://github.com/aholstenson/miio/issues/59

Also have this log issue, though it does not seem to affect the operation of the vacuum at all. So for now I will ignore the log entries!

For those who are ignoring the messages, I had to change the logger settings (see post from @azogue) since the update to 0.57.

In the last line, I had to change

mirobo.device: critical
to
miio.device: critical

Started seeing in logs today (not sure if related to bump from 0.57 or was there all along):

/usr/lib/python3.6/site-packages/homeassistant/components/vacuum/xiaomi_miio.py:90: DeprecationWarning: Please convert to using 'miio' package, this package will be removed at some point in the future
  from mirobo import Vacuum
...
...
/usr/lib/python3.6/site-packages/homeassistant/components/vacuum/xiaomi_miio.py:203: DeprecationWarning: Call to deprecated function dnd (Use vacuum's dnd_status() instead, which is more accurate).
  STATE_ON if self.vacuum_state.dnd else STATE_OFF,

That's not related to this issue, the backend library got bumped without converting the code to use the new package name (the first warning) and dnd_status() (the second warning).

@ferdydek I have the same issue in my log.
@rytilahti is there a fix?

STATE_ON if self.vacuum_state.dnd else STATE_OFF,
/usr/src/app/homeassistant/components/vacuum/xiaomi_miio.py:203: DeprecationWarning: Call to deprecated function dnd (Use vacuum's dnd_status() instead, which is more accurate).

The solution is to avoid calling dnd, which is what was proposed here https://github.com/home-assistant/home-assistant/pull/9733 . The problem was that this broke the unit tests horribly and I haven't had time to look how to fix those properly.

@rytilahti But I don't call dnd, I have the Xiaomi Mi Vacuum component active in my configuration, I haven't done anything else. Is there something I can do to fix this?

@joq3 there is nothing broken, its just log info, not actual drop in functionality.
@rytilahti if I could code Id gladly help, but if you need tests done poke me here or on discord, always happy to assist. ... also the "unable to discover" ... doesnt this come from attempt to autodiscover the device by the lib ?

@joq3 it is coming from the platform requesting dnd status which does not respond with an accurate information and the warning is to show that it should be changed by developers.

@ferdydek the "unable to discover" comes from the library indeed. At the moment the library will try to do a discovery every time before it sends a command to the device, why it fails sometimes is unclear. The tests for this broke as calling dnd_status() instead of reading it from the status message introduces new calls and the tests are looking for a specific ordering of calls, instead of whether those were just called. I'll try to look into fixing it for good before the next release.

I still get those errors even with #10839 merged :/ @rytilahti

Yeah me too.

That PR fixes just deprecated warnings which is unrelated to unavailable/timeout issues, I just linked it here as people started discussing about those here. The cause for timeout / unavailable issues is unknown and may be related to local network setups.

I have similar impression as @rytilahti regarding the cause of the timeouts.

I do get from time to time "Can't upload the map die to low connection speed. Check your network" in HiMome App just after the "Getting info..." disappears.
image

I don't think it has anything to do with my local LAN/WLAN, rather _suspect_ somewhere in the process of getting information a query to Chinese mi servers is passed and that is causing a cascading timeout.
When I will get some free time will try to wireshark the info to verify this suspicion (or maybe someone here could do that faster than me?).

I think there are users having this problem even when they have blocked the external network access for the device, so that cannot be the only reason. To debug this, we would require testing through various versions to see at what point it stopped working (git bisect may help here) to pinpoint that change.

Just chipping in here. I dont use home-assistant but the same issue occurs on a nodejs library (miio) to control the Xiaomi Mi Robot Vacuum Cleaner. It was introduced with the lastest firmware update of the device with version number 3.3.9_003077. It's described here: https://github.com/aholstenson/miio/issues/59

I lack the knowledge to do a proper inspect of the traffic with a MITM attack but that seems the only way to really troubleshoot what's happening.

@jghaanstra The issue you are referring to is closed. You should consider reopening the issue, if it isn鈥檛 solved.

Getting time-outs from the device just means that the device is not answering for a reason or another, there's no simple way to pinpoint what is causing this, but the 3077 firmware incorporated more strict checking of the communication (incl. order of messages, thereby increasing msgids, timestamp handling, ..).

That being said, there may very well be something that's been overlooked, but it is not so simple to find out the real causes on real use-cases with heterogeneous network setups. For many python-miio (or miio in JS) is working just fine, where-as some encounter problems with no apparent / easy to find out reason.

If someone has ideas how to debug these issues please report into issue tracker of those upstream projects where possible, thanks!

Just received a new Mi Robot - was getting this issue on the first setup in HA. Unavailable in UI and timeouts in the logs.

2017-12-22 09:41:12 ERROR (SyncWorker_0) [miio.device] Got error when receiving: timed out

2017-12-22 09:41:12 WARNING (SyncWorker_0) [miio.device] Retrying with incremented id, retries left: 3

I have the same issue. It can't connect to the Xiaomi Vacuum from HomeAssistant, but the mirobo Python library works like a charm on my Mac. (with the same IP + token). Anything I can do to help debugging this issue?

Extracting a new token from a recent IOS backup and upgrading the python-miio package to 0.3.3 fixed the issue for me. I am running the 0.60 version of the Home Assistant Docker image.

@danielpalstra which firmware do you run on the Xiaomi Vacuum?

@iMicknl I updated today to the latest.

Whats the latest version at the moment? I can`t check, since I only use the vacuum via HASS. With 0.3.3 the vacuum becomes unavailable for me in HASS 0.60

I just updated to 3.3.9_003094, python-miio 0.3.3 works like a charm locally. However from within HomeAssistant it is unavailable and times out.

I couldn't find any setting in the MiHome IOS that displays the current firmware.

After restarting Home Assistant running into the same issue again

root@homeserver:/config# tail home-assistant.log
2017-12-27 22:06:48 WARNING (MainThread) [homeassistant.helpers.entity] Update of vacuum.xiaomi_vacuum_cleaner is taking over 10 seconds
2017-12-27 22:06:48 ERROR (SyncWorker_1) [miio.device] Got error when receiving: timed out
2017-12-27 22:06:48 WARNING (SyncWorker_1) [miio.device] Retrying with incremented id, retries left: 2
2017-12-27 22:06:53 ERROR (SyncWorker_1) [miio.device] Got error when receiving: timed out
2017-12-27 22:06:53 WARNING (SyncWorker_1) [miio.device] Retrying with incremented id, retries left: 1
2017-12-27 22:06:58 WARNING (MainThread) [homeassistant.components.vacuum] Updating xiaomi_miio vacuum took longer than the scheduled update interval 0:00:20
2017-12-27 22:06:58 ERROR (SyncWorker_1) [miio.device] Got error when receiving: timed out
2017-12-27 22:06:58 WARNING (SyncWorker_1) [homeassistant.components.vacuum.xiaomi_miio] Got exception while fetching the state:
2017-12-27 22:07:24 ERROR (SyncWorker_6) [miio.device] Got error when receiving: timed out
2017-12-27 22:07:24 WARNING (SyncWorker_6) [miio.device] Retrying with incremented id, retries left: 3

However, still inside the docker container running the mirobo command

root@homeserver:/config# mirobo --ip 192.168.1.xx --token TOKEN status
State: Charging
Battery: 100 %
Fanspeed: 60 %
Cleaning since: 0:00:10
Cleaned area: 0.0 m虏
root@homeserver:/config#

@danielpalstra your errors are not related to this issue. I guess the other issues were fixed with your update and you are left with the point 3 below. But this is not the issue for that problem.

I think we need to close this issue as it begins to suck up all possible issues with miio.
To close the topic @rytilahti correct me if Im wrong:

  1. The depreciated and discovery errors are now corrected (this is what this issue was created for with https://github.com/home-assistant/home-assistant/pull/10839).
  2. The updated library that broke the component at some point was fixed.
  3. The source of disconnects and timeouts is currently unknown and is investigated. Please don't add to this issue, create separate issue for that topic instead.

I think those may be related, but as this issue has started to cover so many different issues, it's starting to get hard to keep track on all of it.

Thanks for summarizing it all to those three points, however, to my understanding it was only the point 3 what was being tracked in this issue, those two others being just unfortunate, unrelated problems. Number 2 was never tracked here (in homeassistant's issue tracker), and I think the fix is still to be released with the next homeassistant release.

The insight that it works with the mirobo tool is an interesting one though, as if that's true then there must be a way to fix it and that the problem has to have something to do with the state handling (the mirobo tool keeps just the msgid stored between executions where-as the platform keeps the whole instance around). What makes it hard to debug is 1) different people have different kinds of network setups, and they all think they are hit by this issue even if it may be just caused by their network setup and 2) this is working for quite a few people just fine, or so I'd assume.

Hey guys,
I just connected my Xiaomi Me to home-assistant but it is displayed as "unavailable".
It prompts: "[miio.device] Unable to discover a device at address xxx.xxx.xxx.xxx"
Token and ID were copy - pasted to config-file, so there is no reason to believe in typing mistakes.
Probably I'm suffering the same issue discussed above.
Best regards

@rytilahti how can I help to gain more insight into "issue 3"?

I am having the same issues after updating Home Assistant to v.60. The Mi Vacuum shows up as unavailable. Before the update everything worked great!

Same issue as above users.

EDIT: My original reply was beyond useless. I have solved my issue and will post it here in hopes of helping someone. My Hass.io version is 60.0.

My problem was I grabbed my token from my iOS device using a .sqlite DB explorer and got a 96 character token. This was not working for me, so I used miio (miio --discover) and got a 32 character token. I tried using this token, but still not working. I would run --discover after pairing the device to my network and my MiHome app, but the token would should '???' when I ran 'miio --discover'... weird.

The solution for me was to take the original 96 character token and decode it to a 32 character token. I forget the website I used, but there are probably a hundred of them that can do the same thing.

Getting the token is described in https://python-miio.readthedocs.io/en/latest/discovery.html#tokens-from-backups . The most reliable way is to extract them from backups, and works with all supported devices. Tokens of vacuums have not been discoverable through other means for a while now. The miio-extract-tokens tool will do decoding if needed automatically for you, and this works for both android & ios backups.

@danielpalstra considering it works in the console, it most likely has something to do with either 1) timing or 2) msg id -- you could enable debug mode and check the timing between the handshake and the status request, maybe the time difference is too great and the robot ignores the request because of that. For message ids, they should always be incremented, so if you see out-of-order msgids that could be something to investigate.

@rytilahti took a spin with the dev Docker image and it seems to be working better. Will double check network and time settings.

Is this perhaps solved by #11232 ? Haven't received any error messages after upgrading python-miio to 0.3.3

Edit: No, still same problem :(

`` mirobo --ip 192.168.1.15 --token xxxxxx State: Charging Battery: 100 % Fanspeed: 60 % Cleaning since: 0:58:56 Cleaned area: 56.6575 m虏 ```` but since I have updated to HomeAssistant 0.63, I receive the same error:Unable to discover the device`. Version of python-mio: 0.3.5

Please make sure you are using the latest version of construct, maybe that will help. What kind of network setup you have, e.g. are you blocking vacuum's access to the xiaomi cloud or not? The error is so generic (which just says that the robot is not responding to your queries) that it's hard to pinpoint where the problem is if you are not receiving any other errors or warnings.

By updating to python-miio to 0.3.6 solves the issue but HA downgrades the library on boot always:
feb 15 23:10:42 camelberry hass[25477]: 2018-02-15 23:10:42 INFO (Thread-5) [homeassistant.util.package] Attempting install of python-miio==0.3.5
How can force the newest python-miio version?

You could start HA by bin/hass --skip-pip

Yes, I have updated the homeassistant.service file to use --skip-pip as temporary solution.

Still getting:

Feb 25 22:38:31 MrMeeSeeks hass[29480]: 2018-02-25 22:38:31 WARNING (Thread-5) [homeassistant.components.vacuum.xiaomi_miio] Got exception while fetching the state: Unable to discover the device 192.168.2.198
Feb 25 22:39:29 MrMeeSeeks hass[29480]: 2018-02-25 22:39:29 ERROR (Thread-9) [miio.device] Got error when receiving: timed out
Feb 25 22:39:29 MrMeeSeeks hass[29480]: 2018-02-25 22:39:29 WARNING (Thread-9) [miio.device] Retrying with incremented id, retries left: 3

info:
construct==2.9.31
homeassistant==0.64.0
python-miio==0.3.7
firmware 3.3.9_003096, HW: ver 1

There is no issue with functionality or sensors. Vacuum works fine.

This is fine. The device doesn't respond sometimes. The second try / retry was successful in your case.

I have
construct==2.9.31
homeassistant==0.64.1
python-miio==0.3.7

The issue with my gen2 roborock is that it鈥檚 unable to discover it anymore.
It was working fine with 0.64. Then I started to add lifx lights which vacuum still worked.
But after setting up homebridge and homebridge home assistant plugin after a restart of home assistant vacuum no longer responds.

Mirobo command line tool also doesn鈥檛 work anymore.

Is this because the vacuum token has changed?
My vacuum does not have access to Internet.
It was working fine pre 0.64 for a whole week.
I would get some b鈥檉ffffffffff errors though.

Any ideas? Tried downgrading same thing. Surprised mirobo command line isn鈥檛 working anymore.
I can check the token again tonight but is the token suppose to change? The vacuum still pings.

Please check your token. It has possibly changed. There is not much known about the 2gen vacuum yet.

So I connected the gen2 xiaomi vacuum back to internet and to mi home android app. The earlier version where you can still get token.
Had to reboot the vacuum.
Felt like the vacuum went into a crashed state due to some reason.

Now I鈥檓 home assistant the fan speed is 102%. Which is suppose to be balanced mode.
Max is 104. I set the speed from the mihome app and I can see home assistant change

It use to say balanced and max. Now just 102%.
Token didn鈥檛 change its back online with home assistant and internet blocked off again.

Strange that it kind of went into a crashed mode and couldn鈥檛 get back online even the mi home couldn鈥檛 detect it until I restarted it.

No idea why the mi home app set the fan speed to 101, 102, 103, 104
Now I鈥檝e rebooted the vacuum again the value reset back to 60% which home assistant tells me it鈥檚 balanced mode again.

Anyone with a gen2 has seen this strange behaviour?
Are the fan values same from gen 1 to gen 2???
Either way it鈥檚 been strange.

After a week of idling. Gen2 vacuum didn鈥檛 respond. And when I restarted hass. It was no longer available.

Starting to think whether I need to allow the vacuum to access dns and ntp maybe.
For those that have not given internet access to the vacuum has yours been working???

Found a post on the forums saying that the vacuum would only work after allowing dns and ntp??
https://community.home-assistant.io/t/what-are-your-strategies-to-protect-your-network-security-privacy/31569

Has anyone here experienced the same thing?
I will try and find out which dns and ntp the vacuum uses and allow it. Will let you all know when I find out.

Sounds like the vacuum retires accessing the internet too much and eventual enters a crashed state.

This is fine. The device doesn't respond sometimes. The second try / retry was successful in your case.

But it's not good if I get these messages up to three times a minute right or am I wrong? https://gist.github.com/tringler/87bd31b43e6cb0955c01a39ee4263b36

I have no problems to call the vacuum cleaner at all. I'm struggling only with these messages all the time. I think [homeassistant.core] Timer got out of sync. Resetting is also caused by these messages but not 100% sure.

No, that's not definitely good. Did you look at the link @beatmag posted? Do you allow your vacuum to connect to the cloud? If not, do you silently drop the packets or are you rejecting them? The former is known to cause (or at least amplify) the problem.

I jumped from 0.65.0 to 0.65.6 and my first gen robovac is not detected anymore. I reject any attempts of my robovac to communicate with the internet. Worked fine till the update to 0.65.6.

See my commentary on https://github.com/home-assistant/home-assistant/issues/11048#issuecomment-375930041 . If someone is having still issues with this (and none of the listed potential causes apply), feel free to open a new issue & including enough information to debug this.

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

i-am-shodan picture i-am-shodan  路  3Comments

kirichkov picture kirichkov  路  3Comments

missedtheapex picture missedtheapex  路  3Comments

MartinHjelmare picture MartinHjelmare  路  3Comments

neonandu picture neonandu  路  3Comments