argrento / huami-token

Script to obtain watch or band bluetooth token from Huami servers
MIT License
411 stars 94 forks source link

Download updated firmware? #12

Open odlg opened 4 years ago

odlg commented 4 years ago

Would it be possible to extend this to download new firmware for Huami devices?

argrento commented 4 years ago

Yes, I think it would be possible. At least I can not see any problems with implementing this feature.

TimelessNL commented 4 years ago

This would be a really nice feature!

I recently acquired a Mi Band 5, and I was wondering how to update the firmware in the future (while running GadgetBridge).

Since GadgetBridge is unable to distribute the firmware, the only official way to update the device is to (re)install the Mi Fit app and (re)pair the device. But this will probably also reset the auth-key?

The unofficial way would be to download them from this topic that distributes (most likely official) firmwares for the MB5 using mega.nz, but I personally would like to download the firmware's myself to ensure they are authentic.

Having huami-token to acquire the firmware/res/font files would be a nice addition 👍.

TimelessNL commented 3 years ago

@argrento, great that this feature is implemented 🥳 . Very much appreciated.

Unfortunately there are 2 issues for me:

  1. The string here is missing a cast, which is causing:
    ID of the device to check for updates (-1 for all of them): 0
    Traceback (most recent call last):
    File "./huami_token.py", line 354, in <module>
    device.get_firmware(wearables[wearable_id])
    TypeError: list indices must be integers or slices, not str
  2. What device did you use during development, my MiBand5 (it being on V1.0.1.84) clearly needs an update but unfortunately the script seems to suggest otherwise (I printed some of the variables to see what is being send/received):
    
    ID of the device to check for updates (-1 for all of them): -1
    Be extremely careful with downloaded files!

Checking for device 0... {'productionSource': '257', 'deviceSource': '59', 'fontVersion': '0', 'fontFlag': '0', 'appVersion': '5.9.2-play_100355', 'firmwareVersion': 'V1.0.1.84', 'hardwareVersion': 'V0.44.18.2', 'support8Bytes': 'true'} <Response [200]> {'deviceType': 'ALL', 'deviceSource': 59, 'ignore': False} No updates found!


The `5.9.2-play_100355` number seems to suggest the [Zepp ](https://www.apkmirror.com/apk/huami/amazfit-watch/amazfit-watch-5-9-2-play-release/zepp-formerly-amazfit-5-9-2-play-android-apk-download/) app and not [Mi Fit](https://www.apkmirror.com/apk/anhui-huami-information-technology-co-ltd/mi-fit/). Or Am I incorrectly assuming this should work on the Mi Bands?
argrento commented 3 years ago
  1. Forgot to test that case. Fixed it.
  2. I'll do some more tests with my Mi Band 5.

Zepp can work correctly with Mi Band (checked by myself). I'll try to figure out with my Mi Band 5, what's the problem.

Thanks!