From 88cc998c84cb24d57d3843696588c57e03fdd11c Mon Sep 17 00:00:00 2001 From: Jaroslaw Swierczynski Date: Mon, 21 Jan 2019 17:44:03 +0100 Subject: [PATCH] New method to obtain tokens --- docs/discovery.rst | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/discovery.rst b/docs/discovery.rst index ee17c7bb0..9274c2545 100644 --- a/docs/discovery.rst +++ b/docs/discovery.rst @@ -43,7 +43,7 @@ encryption token must be known. If the returned a token is with characters other than ``0``\ s or ``f``\ s, it is likely a valid token which can be used directly for communication. If not, the token needs to be extracted from the Mi Home Application, -see :ref:`creating_backup` for information how to do this. +see :ref:`logged_tokens` for information how to do this. .. IMPORTANT:: @@ -87,12 +87,27 @@ Tokens full of ``0``\ s or ``f``\ s (as above) are either already paired with the mobile app or will not yield a token through this method. In those cases the procedure shown in :ref:`creating_backup` has to be used. +.. _logged_tokens: + +Tokens from Mi Home logs +======================== + +The easiest way to obtain tokens is to browse through log files of the Mi Home +app version 5.4.49 for Android. It seems that version was released with debug +messages turned on by mistake. An APK file with the old version can be easily +found using one of the popular web search engines. After downgrading use a file +browser to navigate to directory ``SmartHome/logs/plug_DeviceManager``, then +open the most recent file and search for the token. When finished, use Google +Play to get the most recent version back. + .. _creating_backup: Tokens from backups =================== -Extracting tokens from a Mi Home backup is the preferred way to obtain tokens. +Extracting tokens from a Mi Home backup is the preferred way to obtain tokens +if they cannot be looked up in the Mi Home app version 5.4.49 log files +(e.g. no Android device around). For this to work the devices have to be added to the app beforehand before the database (or backup) is extracted.