cyberjunky / python-garminconnect

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

Adding device solar data endpoint #192

Closed psdupvi closed 3 months ago

psdupvi commented 4 months ago

Issue https://github.com/cyberjunky/python-garminconnect/issues/190

Adding endpoint for device solar data.

I limited the return values to just the specific solar data deviceSolarInput because it's already a lot of data, and I suspect we already return all the other data from the device settings endpoint

If the device has no solar data, it returns the following value (I tested with my non solar 945):

{'solarDailyDataDTOs': []}

With solar data, it returns something like the following

    {
      "solarDailyDataDTOs": 
          [ # List with one entry per day
              {
                  "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? Possibly depends on device                             
                      {
                          "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
        }
        ... # Could be more entries
     ]
}
psdupvi commented 3 months ago

Sorry, accidentally closed PR while cleaning up my own branches

cyberjunky commented 3 months ago

Thanks!