When trying to extract the token from the database, that field was empty. I suspect this might be removed in a new release of the Xiaomi app, but I do not have a source for this.
Does anyone know?
sqlite3 apps/com.xiaomi.smarthome/db/miio2.db 'select name,localIP,token from devicerecord;'
xxx|aaa.bbb.ccc.ddd|
A combination of the ones indicated at https://home-assistant.io/components/vacuum.xiaomi_miio/. The MiToolkit crashed, so I tried adb in an Ubuntu VM. That did not work to get a backup, so I installed adb in Windows which worked fine.
Then, I extracted the backup in the Ubuntu VM using abe.jar, and looked at the database using sqlite3. Since I got the other values, I assume everything was correct so far. The only thing missing, was the token…
Until a fix is issued you should uninstall the Mi Home app and use version 5.0.29 (can be found on APKMirror).
This version has the token saved in miio2.db. If MiToolkit still crashes (which it did for me) you can do a adb backup and extract the db with Android Backup Extractor.
Unfortunately, it seems like they are working to block out third party apps. Maybe it’s not worth the struggle if it only works for a little while (integrating the vacuum would only be for show off anyways )
I really hope there’ll be some clever workaround for this.
Being able to send simple commands to the vacuum is one thing, but the real beauty of having it included in Home Assistant are the possibilities automation gives, like initiating cleanup 30 minutes after all lights are turned off at night. It’s wonderful.
I’ve had no luck retrieving my token either. Deleted current mi home app and installed older 5.0 versions. The token is still absent from the mitoolkit report…
I guess next step is to wipe my android device, install mi home 5.0.29, reset the vacuum and get the new token. Does this token change with updates to mi home or does it stay the same? Can you share mi home devices to other devices with 5.0.29?
Mmh, finally managed to get a token. I now get this error in HA 62.1"
Log Details (ERROR)
Mon Feb 05 2018 13:11:02 GMT+0800 (Malay Peninsula Standard Time)
xiaomi_miio: Error on device update!
Traceback (most recent call last):
File "/usr/src/app/homeassistant/helpers/entity_component.py", line 397, in _async_add_entity
yield from entity.async_device_update(warning=False)
File "/usr/src/app/homeassistant/helpers/entity.py", line 308, in async_device_update
yield from self.hass.async_add_job(self.update)
File "/usr/local/lib/python3.6/asyncio/futures.py", line 327, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/local/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
future.result()
File "/usr/local/lib/python3.6/asyncio/futures.py", line 243, in result
raise self._exception
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/app/homeassistant/components/vacuum/xiaomi_miio.py", line 368, in update
state = self._vacuum.status()
File "/usr/local/lib/python3.6/site-packages/miio/vacuum.py", line 108, in status
return VacuumStatus(self.send("get_status")[0])
File "/usr/local/lib/python3.6/site-packages/miio/device.py", line 216, in send
m = Message.build(msg, ctx)
TypeError: build() takes 2 positional arguments but 3 were given
Just used mitoolkit 1.6 with a mi home app v5.019 on Android. It seems that the component no more works with HA 62.0 and 62.1. A fix may be ready for 62.2. More info on GitHub. Wait to update!
I just received my vacuum yesterday and had trouble getting the token. Here is what worked for me:
If the vacuum is already linked to your Xiaomi account make sure to remove it from your account. I also cleared my Mi Home data completely in android just to make sure.
I’m trying same thing with purifier 2s but from whatever reason I can’t add this device to 5-0-19 mi home app after I got it removed from a latest one. Any idea what could be wrong?