cyberjunky / python-garminconnect

Python 3 API wrapper for Garmin Connect to get activity statistics
MIT License
965 stars 151 forks source link

Are there solar related fileds? #190

Closed xiahan4956 closed 8 months ago

xiahan4956 commented 9 months ago

Hello, I am using Instinct2 solar. I want to stat solar realted data. But I've cheaked all fileds and did not find it.

are there any related fields?

psdupvi commented 8 months ago

There's a Garmin endpoint we could use to get it for a device, although it has not been implemented yet

https://connect.garmin.com/web-gateway/solar/{device_id}/{start_date}/{end_date}?singleDayView=true

I haven't done any exploring but might take a look at this soon.

The response data is something like:

{
    "deviceSolarInput": {
        "solarDailyDataDTOs": [
            {
                "localConnectDate": "2024-03-10",
                "userProfilePk": 71328280,
                "deviceId": 3424284515,
                "solarInputReadings": [
                    {
                        "readingTimestampLocal": "2024-03-10T00:01:00.0",
                        "readingTimestampGmt": "2024-03-10T05:01:00.0",
                        "solarUtilization": 0.0,
                        "notChargingTooHot": false,
                        "notChargingTooCold": false,
                        "notChargingBatteryFull": false,
                        "notChargingExternalPower": false,
                        "notChargingUserDisabled": false,
                        "notChargingOther": true,
                        "activityTimeGainMs": 0,
                        "charging": false,
                        "interpolated": null
                    },
                    {
                       ... one reading per second?
                    },                
                    {
                        "readingTimestampLocal": "2024-03-10T15:55:00.0",
                        "readingTimestampGmt": "2024-03-10T19:55:00.0",
                        "solarUtilization": 0.9900000095367432,
                        "notChargingTooHot": false,
                        "notChargingTooCold": false,
                        "notChargingBatteryFull": false,
                        "notChargingExternalPower": false,
                        "notChargingUserDisabled": false,
                        "notChargingOther": false,
                        "activityTimeGainMs": 34,
                        "charging": true,
                        "interpolated": null
                                        }
                ],
                "totalActivityTimeGainedMs": 429308
            }
        ]
    },

 ...more stuff
psdupvi commented 8 months ago

https://github.com/cyberjunky/python-garminconnect/pull/192

cyberjunky commented 8 months ago

@xiahan4956 added the code from @psdupvi to version 0.2.14, can you check?

xiahan4956 commented 8 months ago

ok I will cheak later 5 day.. prepareing IELTS exam....

Original

From:"Ron"< @.*** >;

Date:2024/3/15 22:39

To:"cyberjunky/python-garminconnect"< @.*** >;

CC:"xiahan4956"< @. >;"Mention"< @. >;

Subject:Re: [cyberjunky/python-garminconnect] Are there solar related fileds?(Issue #190)

@xiahan4956 added the code from @psdupvi to version 0.2.14, can you check?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

cyberjunky commented 8 months ago

@xiahan4956 No worries, good luck with your exam!

xiahan4956 commented 8 months ago

I have tested. it works ! Despite it is needed to input the deviceID, but it doesn't matter.