Issue config xiaomi vacuum by v0.51.1

The following errors have been logged this session:

2017-08-13 18:27:48 WARNING (MainThread) [homeassistant.setup] Setup of vacuum is taking over 10 seconds.
2017-08-13 18:27:48 WARNING (MainThread) [homeassistant.setup] Setup of tts is taking over 10 seconds.
2017-08-13 18:28:10 ERROR (Thread-2) [homeassistant.util.package] Unable to install package python-mirobo==0.1.2: Command “/srv/homeassistant/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-build-4d8m4p_j/cffi/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-9jd8puyj-record/install-record.txt --single-version-externally-managed --compile --install-headers /srv/homeassistant/include/site/python3.4/cffi” failed with error code 1 in /tmp/pip-build-4d8m4p_j/cffi/
2017-08-13 18:28:10 ERROR (MainThread) [homeassistant.setup] Not initializing vacuum.xiaomi because could not install dependency python-mirobo==0.1.2
2017-08-13 18:28:10 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform vacuum.xiaomi: Could not install all requirements.

1 Like

I’ve the same issue and am running on HASSBIAN. Can’t get it to work.

If you are using hassbian goto your virtualenv environment and install python-mirobo manually:

$ ssh [email protected]
$ su - homeassistant
$ source /srv/homeassistant/bin/activate
$ pip3 install python-mirobo==0.1.2

Thanks @syssi can you add the “pip3 install python-mirobo==0.1.2” command to this page https://home-assistant.io/components/vacuum.xiaomi/

That’s what I’ve been missing.

The component retrieves the required libraries automatically normally. I don’t know why it’s failed in your case.

Just ran your command and get the below error:

Command "/srv/homeassistant/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-rhp91lip/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-t5rk_4u_-record/install-record.txt --single-version-externally-managed --compile --install-headers /srv/homeassistant/include/site/python3.4/cryptography" failed with error code 1 in /tmp/pip-build-rhp91lip/cryptography/

Okay, this is the cause. There is a dependency missing to build the library. Just a guess:

sudo apt-get install libffi-dev

And try again.

@syssi I’ve just run that command and I’m already on the latest and the error is just like before (I assume that the sudo command is when I’m outside the VirtualEnv):

[email protected]:~ $ sudo apt-get install libffi-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libffi-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 91 not upgraded.

Here’s everything I see in my Terminal Window. The ERROR is at the very bottom:

[email protected]:~ $ source /srv/homeassistant/bin/activate
(homeassistant) [email protected]:~ $ pip3 install python-mirobo==0.1.2
Collecting python-mirobo==0.1.2
  Downloading python_mirobo-0.1.2-py3-none-any.whl
Collecting cryptography (from python-mirobo==0.1.2)
  Downloading cryptography-2.0.3.tar.gz (427kB)
    100% |████████████████████████████████| 430kB 280kB/s 
Requirement already satisfied: click in /srv/homeassistant/lib/python3.4/site-packages (from python-mirobo==0.1.2)
Requirement already satisfied: typing in /srv/homeassistant/lib/python3.4/site-packages (from python-mirobo==0.1.2)
Requirement already satisfied: pretty-cron in /srv/homeassistant/lib/python3.4/site-packages (from python-mirobo==0.1.2)
Requirement already satisfied: construct in /srv/homeassistant/lib/python3.4/site-packages (from python-mirobo==0.1.2)
Requirement already satisfied: idna>=2.1 in /srv/homeassistant/lib/python3.4/site-packages (from cryptography->python-mirobo==0.1.2)
Requirement already satisfied: asn1crypto>=0.21.0 in /srv/homeassistant/lib/python3.4/site-packages (from cryptography->python-mirobo==0.1.2)
Requirement already satisfied: six>=1.4.1 in /srv/homeassistant/lib/python3.4/site-packages (from cryptography->python-mirobo==0.1.2)
Requirement already satisfied: cffi>=1.7 in /srv/homeassistant/lib/python3.4/site-packages (from cryptography->python-mirobo==0.1.2)
Requirement already satisfied: pycparser in /srv/homeassistant/lib/python3.4/site-packages (from cffi>=1.7->cryptography->python-mirobo==0.1.2)
Installing collected packages: cryptography, python-mirobo
  Running setup.py install for cryptography ... error
    Complete output from command /srv/homeassistant/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-j3hxckrp/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-nzka87xs-record/install-record.txt --single-version-externally-managed --compile --install-headers /srv/homeassistant/include/site/python3.4/cryptography:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-3.4
    creating build/lib.linux-armv7l-3.4/cryptography
    copying src/cryptography/utils.py -> build/lib.linux-armv7l-3.4/cryptography
    copying src/cryptography/exceptions.py -> build/lib.linux-armv7l-3.4/cryptography
    copying src/cryptography/__about__.py -> build/lib.linux-armv7l-3.4/cryptography
    copying src/cryptography/fernet.py -> build/lib.linux-armv7l-3.4/cryptography
    copying src/cryptography/__init__.py -> build/lib.linux-armv7l-3.4/cryptography
    creating build/lib.linux-armv7l-3.4/cryptography/hazmat
    copying src/cryptography/hazmat/__init__.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat
    creating build/lib.linux-armv7l-3.4/cryptography/x509
    copying src/cryptography/x509/extensions.py -> build/lib.linux-armv7l-3.4/cryptography/x509
    copying src/cryptography/x509/base.py -> build/lib.linux-armv7l-3.4/cryptography/x509
    copying src/cryptography/x509/oid.py -> build/lib.linux-armv7l-3.4/cryptography/x509
    copying src/cryptography/x509/name.py -> build/lib.linux-armv7l-3.4/cryptography/x509
    copying src/cryptography/x509/general_name.py -> build/lib.linux-armv7l-3.4/cryptography/x509
    copying src/cryptography/x509/certificate_transparency.py -> build/lib.linux-armv7l-3.4/cryptography/x509
    copying src/cryptography/x509/__init__.py -> build/lib.linux-armv7l-3.4/cryptography/x509
    creating build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/interfaces.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/keywrap.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/cmac.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/mac.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/hmac.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/serialization.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/constant_time.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/__init__.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/padding.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives
    copying src/cryptography/hazmat/primitives/hashes.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives
    creating build/lib.linux-armv7l-3.4/cryptography/hazmat/backends
    copying src/cryptography/hazmat/backends/interfaces.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends
    copying src/cryptography/hazmat/backends/__init__.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends
    creating build/lib.linux-armv7l-3.4/cryptography/hazmat/bindings
    copying src/cryptography/hazmat/bindings/__init__.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/bindings
    creating build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/scrypt.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/kbkdf.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/pbkdf2.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/hkdf.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/x963kdf.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/__init__.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/kdf
    copying src/cryptography/hazmat/primitives/kdf/concatkdf.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/kdf
    creating build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/ciphers
    copying src/cryptography/hazmat/primitives/ciphers/base.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/ciphers
    copying src/cryptography/hazmat/primitives/ciphers/aead.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/ciphers
    copying src/cryptography/hazmat/primitives/ciphers/algorithms.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/ciphers
    copying src/cryptography/hazmat/primitives/ciphers/modes.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/ciphers
    copying src/cryptography/hazmat/primitives/ciphers/__init__.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/ciphers
    creating build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/utils.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/dh.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/dsa.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/x25519.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/rsa.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/__init__.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/padding.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/asymmetric
    copying src/cryptography/hazmat/primitives/asymmetric/ec.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/asymmetric
    creating build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/twofactor
    copying src/cryptography/hazmat/primitives/twofactor/utils.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/twofactor
    copying src/cryptography/hazmat/primitives/twofactor/totp.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/twofactor
    copying src/cryptography/hazmat/primitives/twofactor/hotp.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/twofactor
    copying src/cryptography/hazmat/primitives/twofactor/__init__.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/primitives/twofactor
    creating build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/utils.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/x509.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/cmac.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/dh.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/ciphers.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/aead.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/dsa.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/x25519.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/hmac.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/backend.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/rsa.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/encode_asn1.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/decode_asn1.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/__init__.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/ec.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    copying src/cryptography/hazmat/backends/openssl/hashes.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/backends/openssl
    creating build/lib.linux-armv7l-3.4/cryptography/hazmat/bindings/openssl
    copying src/cryptography/hazmat/bindings/openssl/binding.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/bindings/openssl
    copying src/cryptography/hazmat/bindings/openssl/_conditional.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/bindings/openssl
    copying src/cryptography/hazmat/bindings/openssl/__init__.py -> build/lib.linux-armv7l-3.4/cryptography/hazmat/bindings/openssl
    running egg_info
    writing top-level names to src/cryptography.egg-info/top_level.txt
    writing src/cryptography.egg-info/PKG-INFO
    writing requirements to src/cryptography.egg-info/requires.txt
    writing dependency_links to src/cryptography.egg-info/dependency_links.txt
    reading manifest file 'src/cryptography.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    no previously-included directories found matching 'docs/_build'
    warning: no previously-included files matching '*' found under directory 'vectors'
    writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
    running build_ext
    generating cffi module 'build/temp.linux-armv7l-3.4/_padding.c'
    creating build/temp.linux-armv7l-3.4
    generating cffi module 'build/temp.linux-armv7l-3.4/_constant_time.c'
    generating cffi module 'build/temp.linux-armv7l-3.4/_openssl.c'
    building '_openssl' extension
    creating build/temp.linux-armv7l-3.4/build
    creating build/temp.linux-armv7l-3.4/build/temp.linux-armv7l-3.4
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/srv/homeassistant/include -I/usr/include/python3.4m -c build/temp.linux-armv7l-3.4/_openssl.c -o build/temp.linux-armv7l-3.4/build/temp.linux-armv7l-3.4/_openssl.o -Wconversion -Wno-error=sign-conversion
    build/temp.linux-armv7l-3.4/_openssl.c:434:30: fatal error: openssl/opensslv.h: No such file or directory
     #include <openssl/opensslv.h>
                                  ^
    compilation terminated.
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/srv/homeassistant/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-j3hxckrp/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-nzka87xs-record/install-record.txt --single-version-externally-managed --compile --install-headers /srv/homeassistant/include/site/python3.4/cryptography" failed with error code 1 in /tmp/pip-build-j3hxckrp/cryptography/

If there’s no further ideas I may have to install from scratch on a fresh HASSBIAN and who knows it may fix itself???

This is the line it’s complaining about:

build/temp.linux-armv7l-3.4/_openssl.c:434:30: fatal error: openssl/opensslv.h: No such file or directory

This will solve this issue:

sudo apt-get install libssl-dev
1 Like

OK, Thanks @syssi Awesome all working now!!!

I’ve gone and run all the commands from the beginning. Hopefully this will help others. These are the commands run after SSH into Hassbian:

[email protected]:~ $ sudo apt-get update
[email protected]:~ $ sudo apt-get install libffi-dev
[email protected]:~ $ sudo apt-get install libssl-dev
[email protected]:~ $ sudo su -s /bin/bash homeassistant
[email protected]:/home/pi $ source /srv/homeassistant/bin/activate
(homeassistant) [email protected]:/home/pi $ pip3 install python-mirobo==0.1.2
(homeassistant) [email protected]:/home/pi $ exit
[email protected]:~ $ sudo reboot

I don’t get any errors running the above so hopefully it works for other people having similar issues to myself. Below is the fully list of what i’m seeing when I run all the above items.

[email protected]:~ $ sudo apt-get install libffi-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libffi-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 91 not upgraded.
[email protected]:~ $ sudo apt-get install libssl-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libssl-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 91 not upgraded.
[email protected]:~ $ sudo su -s /bin/bash homeassistant
[email protected]:/home/pi $ source /srv/homeassistant/bin/activate
(homeassistant) [email protected]:/home/pi $ pip3 install python-mirobo==0.1.2
Collecting python-mirobo==0.1.2
  Using cached python_mirobo-0.1.2-py3-none-any.whl
Requirement already satisfied: construct in /srv/homeassistant/lib/python3.4/site-packages (from python-mirobo==0.1.2)
Requirement already satisfied: click in /srv/homeassistant/lib/python3.4/site-packages (from python-mirobo==0.1.2)
Collecting cryptography (from python-mirobo==0.1.2)
  Using cached cryptography-2.0.3.tar.gz
Requirement already satisfied: typing in /srv/homeassistant/lib/python3.4/site-packages (from python-mirobo==0.1.2)
Requirement already satisfied: pretty-cron in /srv/homeassistant/lib/python3.4/site-packages (from python-mirobo==0.1.2)
Requirement already satisfied: idna>=2.1 in /srv/homeassistant/lib/python3.4/site-packages (from cryptography->python-mirobo==0.1.2)
Requirement already satisfied: asn1crypto>=0.21.0 in /srv/homeassistant/lib/python3.4/site-packages (from cryptography->python-mirobo==0.1.2)
Requirement already satisfied: six>=1.4.1 in /srv/homeassistant/lib/python3.4/site-packages (from cryptography->python-mirobo==0.1.2)
Requirement already satisfied: cffi>=1.7 in /srv/homeassistant/lib/python3.4/site-packages (from cryptography->python-mirobo==0.1.2)
Requirement already satisfied: pycparser in /srv/homeassistant/lib/python3.4/site-packages (from cffi>=1.7->cryptography->python-mirobo==0.1.2)
Installing collected packages: cryptography, python-mirobo
  Running setup.py install for cryptography ... done
Successfully installed cryptography-2.0.3 python-mirobo-0.1.2
(homeassistant) [email protected]:/home/pi $ exit
exit
[email protected]:~ $ sudo reboot
2 Likes

For completeness: If you start with libffi-dev and libssl-dev already installed home assistant is able to retrieve and build the required libraries (python-mirobo) automatically. So there is no need for “pip3 install <library” normally. Next time check your home-assistant.log first. It will point to the missing system requirements / files.

2 Likes

Hey @syssi, my ipad just updated to iOS 7.3.3 and it looks like the iPAD instructions for getting the TOKEN via the “1234567_mihome.sqlite” no longer works. https://home-assistant.io/components/xiaomi/#retrieving-the-access-token

Previously the ZTOKEN field carried a 32 character key but since the update to iOS 10.3.3 the field carries a 96 character length token, which is being rejected by the Vacuum component.

I did this on a friend’s iPad also and the result is the same. I can only assume that with the upgrade to iOS 10.3.3 the token keys are being encrypted by Apple so we can’t access them in clear text (like before with the 32 character key). Is this assumption correct?

I don’t know the exact origin of the changed tokens but you are right. Just take a look here:

and

Thanks mate, for me this behaviour occurred immediately after upgrading to iOS 10.3.3 so I think it’s a safe bet to assume that is what caused the change.

My mate used the Android and Windows instructions and he got the token that way. I’ll have to try the same… Hopefully there’s an easier way…

The issue applies to iOS 10.3.1, too. Could you provide the version of your Mi Home app?

Yeay! I managed to decrypt the 96 character token into a 32 character one. Please take a look at Xiaomi Gateway Integration

I followed the instructions from
https://home-assistant.io/components/vacuum.xiaomi/
But I could not use the instruction for retrieving the Token. Using my mac and an android, I did manage to get a backup file but failed in the later step where it seemed that the tar was corrupt or something.
However, I managed to retrieve the token using this tool:


Result:
Device ID: 64640065
Model info: Unknown
Address:
Token: via auto-token
Support: Unknown

I put this in my configuration.yaml

Xiaomi rockrobo

vacuum:

  • platform: xiaomi
    name: Rockrobo
    host: 192.168.x.xxx
    token:

But it is marked as Unavailable in the GUI and I’m
Getting these errors in the log:
2017-09-dd hh:mm:ss ERROR (Thread-10) [mirobo.device] Got error when receiving: timed out
2017-09-dd hh:mm:ss WARNING (MainThread) [homeassistant.components.vacuum.xiaomi] Got exception while fetching the state:
2017-09-dd hh:mm:ss ERROR (Thread-8) [mirobo.device] Got error when receiving: timed out

Could the token be changing?

You need a token. You cannot communicate with the device without a token. What do you mean be changing? Some users discovered the token changes if you pair the robot at the mi home app a second time.