How to update AGPS
AGPS files need to be downloaded from the Huami servers, then sent to the watch. This can be achieved with the following method
- Use the huami-token python tool to download the AGPS files
- git clone https://github.com/piggz/huami-token
- Use the Amazfish custom button handling to script downloading the files and uploading to the device
- Create a script harbour-amazfish-script.sh with the following content
#!/bin/sh
if [ "$1" == "3" ]; then
dbus-send --session \
--dest=uk.co.piggz.amazfish \
--print-reply \
/application \
uk.co.piggz.amazfish.sendAlert \
dict:string:variant:"id,int32:1,appId,string:io.github.amazfish,appName,string:AGPS-script,summary,string:AGPS,body,string:Downloading files..." boolean:false
python3 ~/huami-token/huami_token.py -m <method> -g -e <email> -p <password>
dbus-send --session \
--dest=uk.co.piggz.amazfish \
--print-reply \
/application \
uk.co.piggz.amazfish.sendAlert \
dict:string:variant:"id,int32:1,appId,string:io.github.amazfish,appName,string:AGPS-script,summary,string:AGPS,body,string:Uploading files..." boolean:false
dbus-send --session --print-reply --dest=uk.co.piggz.amazfish /application uk.co.piggz.amazfish.prepareFirmwareDownload string:'/home/defaultuser/gps_uihh.bin'
sleep 1
dbus-send --session --print-reply --dest=uk.co.piggz.amazfish /application uk.co.piggz.amazfish.startDownload
dbus-send --session \
--dest=uk.co.piggz.amazfish \
--print-reply \
/application \
uk.co.piggz.amazfish.sendAlert \
dict:string:variant:"id,int32:1,appId,string:io.github.amazfish,appName,string:AGPS-script,summary,string:AGPS,body,string:AGPS Update Started" boolean:false
fi;
Change the method, email and password to match your huami/amazfit account type (see the docs for huami-token)
- In Amazfish, Settings, Application, Button Actions, set the Triple Press Action to Custom Script