Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xiaomi Vacuum Cleaner robot timeout / unavailable #8982

Closed
meetyourlaser opened this issue Aug 14, 2017 · 10 comments
Closed

Xiaomi Vacuum Cleaner robot timeout / unavailable #8982

meetyourlaser opened this issue Aug 14, 2017 · 10 comments

Comments

@meetyourlaser
Copy link

Home Assistant release (hass --version):
0.51.1

Python release (python3 --version):
3.4.2

Component/platform:
vacuum

Description of problem:
I’ve just updated to Home Assistant v. 0.51.1 (python version 3.4.2, Xiaomi Vacuum Cleaner firmware version 3.3.9_003077). I also downloaded the newest version of xiaomi.py (due to #8954). Without the new xiaomi.py my vacuum cleaner didn’t appear at all in HA. With the update it appears‚ but it’s listed as unavailable.

Expected:

Problem-relevant configuration.yaml entries and steps to reproduce:

vacuum:
  - platform: xiaomi
    name: 'wolfe'
    host: !secret xiaomi_vacuum_robot_ip
    token: !secret xiaomi_vacuum_robot_token

Additional info:

Output from the dev-info page (I guess not everything is relvant, but maybe …):

2017-08-14 11:57:51 ERROR (Thread-11) [mirobo.device] Got error when receiving: timed out 
2017-08-14 11:57:51 WARNING (Thread-11) [mirobo.device] Retrying with incremented id, retries left: 3 
2017-08-14 11:57:53 WARNING (MainThread) [homeassistant.components.vacuum] Setup of platform xiaomi is taking over 10 seconds. 
2017-08-14 11:57:56 ERROR (Thread-11) [mirobo.device] Got error when receiving: timed out 
2017-08-14 11:57:56 WARNING (Thread-11) [mirobo.device] Retrying with incremented id, retries left: 2 
2017-08-14 11:58:01 ERROR (Thread-11) [mirobo.device] Got error when receiving: timed out 
2017-08-14 11:58:01 WARNING (Thread-11) [mirobo.device] Retrying with incremented id, retries left: 1 
2017-08-14 11:58:03 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step result = next(coro) File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 381, in async_process_entity new_entity, self, update_before_add=update_before_add File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 238, in async_add_entity yield from entity.async_update_ha_state() File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 246, in async_update_ha_state attr = self.state_attributes or {} File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/light/__init__.py", line 426, in state_attributes value = getattr(self, prop) File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/light/lifx.py", line 436, in color_temp kelvin = self.device.color[3] TypeError: 'NoneType' object is not subscriptable 
2017-08-14 11:58:03 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step result = next(coro) File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 381, in async_process_entity new_entity, self, update_before_add=update_before_add File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 238, in async_add_entity yield from entity.async_update_ha_state() File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 246, in async_update_ha_state attr = self.state_attributes or {} File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/light/__init__.py", line 426, in state_attributes value = getattr(self, prop) File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/light/lifx.py", line 436, in color_temp kelvin = self.device.color[3] TypeError: 'NoneType' object is not subscriptable 
2017-08-14 11:58:03 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step result = next(coro) File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 381, in async_process_entity new_entity, self, update_before_add=update_before_add File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 238, in async_add_entity yield from entity.async_update_ha_state() File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 246, in async_update_ha_state attr = self.state_attributes or {} File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/light/__init__.py", line 426, in state_attributes value = getattr(self, prop) File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/light/lifx.py", line 436, in color_temp kelvin = self.device.color[3] TypeError: 'NoneType' object is not subscriptable 
2017-08-14 11:58:04 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step result = next(coro) File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 381, in async_process_entity new_entity, self, update_before_add=update_before_add File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 238, in async_add_entity yield from entity.async_update_ha_state() File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity.py", line 246, in async_update_ha_state attr = self.state_attributes or {} File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/light/__init__.py", line 426, in state_attributes value = getattr(self, prop) File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/light/lifx.py", line 436, in color_temp kelvin = self.device.color[3] TypeError: 'NoneType' object is not subscriptable 
2017-08-14 11:58:06 ERROR (Thread-11) [mirobo.device] Got error when receiving: timed out 
2017-08-14 11:58:06 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: 
2017-08-14 11:58:33 ERROR (Thread-3) [mirobo.device] Got error when receiving: timed out 
2017-08-14 11:58:33 WARNING (Thread-3) [mirobo.device] Retrying with incremented id, retries left: 3 
2017-08-14 11:58:36 WARNING (Thread-10) [homeassistant.components.zwave] zwave not ready after 30 seconds, continuing anyway 
2017-08-14 11:58:37 WARNING (MainThread) [homeassistant.helpers.entity] Update of vacuum.wolfe is taking over 10 seconds 
2017-08-14 11:58:38 ERROR (Thread-3) [mirobo.device] Got error when receiving: timed out 
2017-08-14 11:58:38 WARNING (Thread-3) [mirobo.device] Retrying with incremented id, retries left: 2 
2017-08-14 11:58:43 ERROR (Thread-3) [mirobo.device] Got error when receiving: timed out 
2017-08-14 11:58:43 WARNING (Thread-3) [mirobo.device] Retrying with incremented id, retries left: 1 
2017-08-14 11:58:47 WARNING (MainThread) [homeassistant.components.vacuum] Updating xiaomi vacuum took longer than the scheduled update interval 0:00:20 
2017-08-14 11:58:48 ERROR (Thread-3) [mirobo.device] Got error when receiving: timed out 
2017-08-14 11:58:48 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: 
2017-08-14 11:59:13 ERROR (Thread-8) [mirobo.device] Got error when receiving: timed out 
2017-08-14 11:59:13 WARNING (Thread-8) [mirobo.device] Retrying with incremented id, retries left: 3 
2017-08-14 11:59:18 WARNING (MainThread) [homeassistant.helpers.entity] Update of vacuum.wolfe is taking over 10 seconds 
2017-08-14 11:59:18 ERROR (Thread-8) [mirobo.device] Got error when receiving: timed out 
2017-08-14 11:59:18 WARNING (Thread-8) [mirobo.device] Retrying with incremented id, retries left: 2 
2017-08-14 11:59:23 ERROR (Thread-8) [mirobo.device] Got error when receiving: timed out 
2017-08-14 11:59:23 WARNING (Thread-8) [mirobo.device] Retrying with incremented id, retries left: 1 
2017-08-14 11:59:28 ERROR (Thread-8) [mirobo.device] Got error when receiving: timed out 
2017-08-14 11:59:28 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: 
2017-08-14 11:59:34 ERROR (Thread-10) [mirobo.device] Got error when receiving: timed out 
2017-08-14 11:59:34 WARNING (Thread-10) [mirobo.device] Retrying with incremented id, retries left: 3 
2017-08-14 11:59:39 WARNING (MainThread) [homeassistant.helpers.entity] Update of vacuum.wolfe is taking over 10 seconds 
2017-08-14 11:59:39 ERROR (Thread-10) [mirobo.device] Got error when receiving: timed out 
2017-08-14 11:59:39 WARNING (Thread-10) [mirobo.device] Retrying with incremented id, retries left: 2 

Not sure if relevant, but this is the output from 'mirobo' started from CLI (with both IP and token set):

ERROR:mirobo.vacuum_cli:Unable to read the stored msgid: [Errno 2] No such file or directory: '/tmp/python-mirobo.seq'
ERROR:mirobo.device:Got error when receiving: timed out
WARNING:mirobo.device:Retrying with incremented id, retries left: 3
ERROR:mirobo.device:Got error when receiving: timed out
WARNING:mirobo.device:Retrying with incremented id, retries left: 2
ERROR:mirobo.device:Got error when receiving: timed out
WARNING:mirobo.device:Retrying with incremented id, retries left: 1
ERROR:mirobo.device:Got error when receiving: timed out
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.4/site-packages/mirobo/device.py", line 127, 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 "/srv/homeassistant/lib/python3.4/site-packages/mirobo/device.py", line 127, 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 "/srv/homeassistant/lib/python3.4/site-packages/mirobo/device.py", line 127, 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 "/srv/homeassistant/lib/python3.4/site-packages/mirobo/device.py", line 127, 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 "/srv/homeassistant/bin/mirobo", line 11, in <module>
    sys.exit(cli())
  File "/srv/homeassistant/lib/python3.4/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/srv/homeassistant/lib/python3.4/site-packages/click/core.py", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/srv/homeassistant/lib/python3.4/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/srv/homeassistant/lib/python3.4/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/mirobo/vacuum_cli.py", line 78, in cli
    ctx.invoke(status)
  File "/srv/homeassistant/lib/python3.4/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/mirobo/vacuum_cli.py", line 104, in status
    res = vac.status()
  File "/srv/homeassistant/lib/python3.4/site-packages/mirobo/vacuum.py", line 87, in status
    return VacuumStatus(self.send("get_status")[0])
  File "/srv/homeassistant/lib/python3.4/site-packages/mirobo/device.py", line 144, in send
    return self.send(command, parameters, retry_count-1)
  File "/srv/homeassistant/lib/python3.4/site-packages/mirobo/device.py", line 144, in send
    return self.send(command, parameters, retry_count-1)
  File "/srv/homeassistant/lib/python3.4/site-packages/mirobo/device.py", line 144, in send
    return self.send(command, parameters, retry_count-1)
  File "/srv/homeassistant/lib/python3.4/site-packages/mirobo/device.py", line 145, in send
    raise DeviceException from ex
mirobo.device.DeviceException
@azogue
Copy link
Member

azogue commented Aug 14, 2017

Not sure if relevant, but this is the output from 'mirobo' started from CLI (with both IP and token set):

It is totally relevant, because if mirobo can't connect to your botvac, HA is never going to do it.

Please check these, there are very basic questions, but if the botvac connexion has never been done, perhaps one of these is the key to solve your problem:

  • Are you sure the IP of the botvac is ok?
  • Are you sure the botvac has a good Wifi connexion?
  • Are you sure the token you're using is ok?
  • Have you updated the firmware after obtaining the token? If so, perhaps you need to repeat the operation to get it.

@azogue
Copy link
Member

azogue commented Aug 14, 2017

In my case, sometimes the connexion with the botvac is lost, and when HA is updating the state, it logs some errors:

2017-08-14 10:04:10 ERROR (Thread-20) [mirobo.device] Unable to discover a device at address 192.168.1.X
2017-08-14 10:04:10 WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state: Unable to discover the device 192.168.1.X

That is considered 'normal', because it looks like the botvac is a little lazy when answering requests, and normally, in the next update, it answers correctly and no harm is done.
To hide these error messages and maintain clean logs, I've configured the logger with these:

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

But in your case, it looks like HA (or mirobo) has never connected correctly to the botvac, so first thing to check is if the authorization data (token) and the botvac IP are ok.

@azogue
Copy link
Member

azogue commented Aug 14, 2017

The firmware you have (3.3.9_003077) is the same as mine, and I think is the last, but there is no problem with that, I can asure.

@MrUkleja
Copy link

Hi,
I am having same errors in log.
After upgrading Hass.io to 0.51.1 my vacuum was not detected.

What I did was refreshing vacuum state on MiHome app so I was sure Vacuum was communicating. I can confirm it is lazy to communicate :)
Than I restarted HA and it was able to find vacuum.

Vacuum works but I still get same messages in log as in first post. I can paste my log here when I get home (my internet is down so I can not connect from work)

@azogue
Copy link
Member

azogue commented Aug 14, 2017

Hi @MrUkleja, if yours is working, until we get a better solution (possibly changing something in the python-mirobo library), I suggest you to config the logger as I exposed above, if you want clean logs.

The HA restart suggestion after checking the vacuum with the official app is always a good one, @meetyourlaser, have you tried it?

@meetyourlaser
Copy link
Author

@azogue @MrUkleja
I found the problem! I had only looked into _mihome.sqlite, but the correct token was in 1722945279_mihome.sqlite.

Everything is working fine now.

@MrUkleja
Copy link

@azogue I did logger config you suggested, but I am still getting errors in log:
2017-08-14 15:35:30 ERROR (MainThread) [homeassistant.helpers.entity] Update for vacuum.mi_robot_vacuum fails
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 223, in async_update_ha_state
yield from self.async_update()
File "/usr/lib/python3.6/site-packages/homeassistant/components/vacuum/xiaomi.py", line 346, in async_update
state = yield from self.hass.async_add_job(self._vacuum.status)
File "/usr/lib/python3.6/asyncio/futures.py", line 331, in iter
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup
future.result()
File "/usr/lib/python3.6/asyncio/futures.py", line 244, in result
raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.6/site-packages/mirobo/vacuum.py", line 87, in status
return VacuumStatus(self.send("get_status")[0])
File "/usr/lib/python3.6/site-packages/mirobo/device.py", line 92, in send
self.do_discover()
File "/usr/lib/python3.6/site-packages/mirobo/device.py", line 44, in do_discover
raise DeviceException("Unable to discover the device %s" % self.ip)
mirobo.device.DeviceException: Unable to discover the device 192.168.0.169

But i am on 0.51.1 and i see that in 0.51.2 there is this change:
fix DeviceException handling when updating xiaomi vacuum (@azogue - #8954) (vacuum.xiaomi docs)

So ... waiting for update :)

@azogue
Copy link
Member

azogue commented Aug 14, 2017

0.51.2 is published, you can update it now

@MrUkleja
Copy link

I am on Hassio and update doesn't show up there yet.

@azogue
Copy link
Member

azogue commented Aug 14, 2017

Didn't see that before, I'm closing this issue.

I found the problem! I had only looked into _mihome.sqlite, but the correct token was in 1722945279_mihome.sqlite.
Everything is working fine now.

@azogue azogue closed this as completed Aug 14, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Dec 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants