rolandsz / Mi-Fit-and-Zepp-workout-exporter

A Python script which allows users to export workout data from Mi Fit and Zepp applications.
https://rolandszabo.com/reverse-engineering/mi-fit/export-mi-fit-and-zepp-workout-data
MIT License
127 stars 13 forks source link

Export other data besides the workouts #19

Open maximmasiutin opened 8 months ago

maximmasiutin commented 8 months ago

Thank you very much for your application! Could you please expand the application by adding functionality to export other data besides the workouts. Such additional data worth exporting is weight measurements, etc. Thank you again!

ganq76 commented 8 months ago

I agree with you. In Zepp and Mi-Fit application, there is no possibility to have data of swimming pool activity. We have access to summary data but not timing of every lap... I will try to find this, I hope someone could find the good variable to extract

rolandsz commented 7 months ago

@maximmasiutin Unfortunately, I no longer use a Mi Band (and Zepp), which somewhat limits my motivation to continue expanding the scope of this application. After some digging, I found an old script which synchronizes weight measurements to Garmin Connect, here is the relevant endpoint if you'd like to experiment with a data exporter:

from datetime import datetime

from httpx import AsyncClient

async def get_weight_records(last_weigh_in_date: datetime, token: str, user_id: str) -> dict:
    async with AsyncClient() as client:
        resp = await client.get(
            url=f"https://api-mifit.huami.com/users/{user_id}/members/-1/weightRecords",
            headers={
                "apptoken": token,
                "appPlatform": "web",
                "appname": "com.xiaomi.hm.health",
            },
            params={"fromTime": int(last_weigh_in_date.timestamp()) + 1},
        )
        resp.raise_for_status()

    return resp.json()

I hope it helps!

ganq76 commented 7 months ago

thanks you but I want to extract the lap or distance from a swimpool activity because I havent any GPS indication. At the end of the activity, the summary indicate the number of rotation but not the time of each rotation. I think, these data exist as the heart rate or other things, but I dont find the good variables. Do you think is it possible to extract the whole data of each workout ? Or to find the distance (or lap) parameter ?