Amazfish Custom Script

try using the -g parameter to download the gps file and see if that works

Thanks!

Using the above it tells me it is downloading. Then it logs out. To run the above command I have to cd into the huami-token folder.

The following must be run in the /home/defaultuser-folder: sh ./harbour-amazfish-script.sh 3 -g

Nothing more happens than if I just enter: sh ./harbour-amazfish-script.sh 3

Does it say if its building the GPS UIHH file like below?

[defaultuser@PhoneX23 ~]$ python3 ~/huami-token/huami_token.py -m amazfit -g -e -p
Getting access token with amazfit login method…
Token: [‘DQVBQDZOQmJaR0YyajYmWnJoBAgAAAAAAYT1EbURRM0xtMHhvcDMyUVZ5QVRvX2ZuZ0FBQVhrLVpTWUcmcj0xMCZ0PWh1YW1pJnRpPWFkYW1AcGlnZ3ouY28udWsmaD0xNzA5NTU4OTgzNjUzJmk9ODY0MDAwJnVzZXJuYW1lPWFkYW1Voh7UE9HN_COkrk8KbnRB’]
Logging in…
Logged in! User id: 7048326150
Downloading AGPS_ALM…
Downloading AGPSZIP…
Downloading LLE…
Downloading AGPS…
Building gps_uihh.bin

Logged out.

No, it quits after
Downloading AGPS…

Like so:

Downloading AGPS_ALM…
Downloading AGPSZIP…
Downloading LLE…
Downloading AGPS…

Logged out.

Ok good, that just means you checked out the wrong branch
Try something like
cd huami-token
git checkout uihh

It answers me thusly:

[defaultuser@Xperia10III huami-token]$ git checkout uihh

error: pathspec ‘uihh’ did not match any file(s) known to git

try
git fetch origin
git checkout origin/uihh

Something is wrong with my setup, I guess. This is the exact output:

[defaultuser@Xperia10III huami-token]$ git fetch origin
[defaultuser@Xperia10III huami-token]$ git checkout origin/uihh
error: pathspec ‘origin/uihh’ did not match any file(s) known to git

show
cat .git/config

[defaultuser@Xperia10III huami-token]$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote “origin”]
url = GitHub - argrento/huami-token: Script to obtain watch or band bluetooth token from Huami servers
fetch = +refs/heads/:refs/remotes/origin/
[branch “master”]
remote = origin
merge = refs/heads/master

Ah ok, so you cloned the wrong repo
cd
rm -rf huami-token
git clone -b uihh GitHub - piggz/huami-token: Script to obtain watch or band bluetooth token from Huami servers
then try again

That was it!

I guess the link changed since I made the manual.

I’ve come back to play with this again. I haven’t had time to spend up till now.

When I run the script file I get this.
Downloading AGPS_ALM…
Downloading AGPSZIP…
Downloading LLE…
Downloading AGPS…

Logged out.

It looks like I haven’t been able to clone the repo properly. I don’t have a huami-token folder. If I try a cd huami-token command I get “can’t cd to to huami-token: No such file or directory”

I cannot run “git clone -b uihh …” I get “bash: git: not found”

If I try git fetch origin I get “git not found”

Do I need to install git?

Is there something else I’m missing?

1 Like

Yes, you need to install git.

Maybe I can paste my manual here but change to the correct link to be copied.

How do you install git?

I think I figured out the installation of git.

Step-by-step Guide
How to Update AGPS in Amazfish

NB! Stay out of root unless specified or completely necessary.
For this to work it is good if you are somewhat familiar with the termina. You need terminal
activated on your Sailfish phone by activating the developer tools.

PLEASE PROCEED AT YOUR OWN RISK!

  1. Use the huami-token python tool to download the AGPS files

Follow steps here: GitHub - piggz/huami-token: Script to obtain watch or band bluetooth token from Huami servers
Prerequisits:

  1. Your login method in Zepp or the Amazfit App must be “Email” and not the social media logins
  2. Make sure you have previously paired, synced and updated your watch in the Zepp or Amazfit
    App.

What needs to be done:

  1. Clone the repo
    1a: First you need to install git and for that you need to have installed zypper:
    To install zypper: pkcon install zypper
    To install git: devel-su zypper in git
    (Make sure you are not still root after this command and if you are, type exit and hit enter)
    1b: When git is installed you clone the repo using the following command:
    git clone https ://github.com/piggz/huami-token (<-remove space after https)

  2. Install requirements
    2a: Make sure that you have Python3 installed in your system by running the following command:
    pkcon install python3-pip
    2b: Run the following command to install Requirements:
    pip3 install -r requirements.txt

  3. Log in with your Amazfit account
    (If you have a Xiaomi account, please find out how to login by visiting:
    GitHub - piggz/huami-token: Script to obtain watch or band bluetooth token from Huami servers)
    3a: To log in to your Amazfit account, use this command (change the bold):
    python3 huami_token.py --method amazfit --email youemail@example.com --password your_password --bt_keys
    3b: If everything is fine so far, the output should look something like:

python3 huami_token.py --method amazfit --email my_email --password password
–bt_keys
Getting access token with amazfit login method…Token: [‘UaFHW53RJVYwqXaa7ncPQ’]
Logging in…
Logged in! User id: 1234567890
Getting linked wearables…
±---------------------------------------------------------------------+
| ID | ACT |
MAC
|
auth_key
|
|-----±----±------------------±-------------------------------------|
| 0 | 1 | AB:CD:EF:12:34:56 |
0xa3c10e34e5c14637eea6b9efc06106
|
±---------------------------------------------------------------------+
Logged out.
YOU ARE NOW DONE WITH THE HUAMI-TOKEN PART.


Create a script that will handle the task of transferring the AGPS update
to the watch.

As defaultuser in terminal (NOT ROOT), create a script called harbour-amazfish-script.sh

01: Make sure you have got nano installed (other typing functions also work, but nano is used in this tutorial) by entering the following command:
pkcon install nano

1a: Create the script file by typing
nano harbour-amazfish-script.sh
You will get an empty space where you can type.
1b: Copy the script content and paste it in the script file
The script content can be copied under point 2 on

1c: Make sure the line breaks are EXACTLY as you find them on the above site
1d: Click ctrl and then x (to exit the script file)
1e: They will ask you if you want to save, type Y and hit enter
1f: They will ask you about the file name which will be the same as you typed under point 1a (above), hit enter
That should be all that needs to be done about the script.

Lastly, Configure the triple button press
1: Open Amazfish and go to settings
2: Go to Aplication Settings
3: Go to Button Actions
4: Change Triple Press Action to Custom Script

You should now be done and ready. By simply pressing your button three times in a row things should start happening both on your phone and on your watch (sometimes you need to press it some times more). Both devices should have a text come up to say “Downloading” and “Uploading” successively.

1 Like

Thank you Martin,

I have came back to update where I’m up to, and I see you have posted your method. Thank you. I haven’t had time to read through it to see how it compares with what I ended up doing.

I have been playing around again and finally I have got it sorted… I think. Looks like I have successfully made an APGS update.

I got git installed and then successfully cloned Adams repo.

Things didn’t work off the bat. In the end I had to copy the files of the huami-token folder back to the defaultuser folder to get it to work.

I need to go and do other things now but will come back and look at your instructions.

Thanks again

2 Likes

It is a little bit without order here, it is better in my document and I just copy pasted it onto here with minor changes. Maybe I will have time to come back and fix the layout. Glad that it seems you have made it work.

All the best!

/Martin