Polar sync now supported

Intervals.icu now supports download of activities and wellness data from Polar via their API. Just tick the boxes in /settings and authorise Intervals.icu:

Only new activities are downloaded. This is a limitation of the Polar API. I did investigate implementing “Import all data” like Garmin using the file they send you when you ask for your data. Unfortunately you can’t re-create what you would get from the API using the data they send you. Altitude is missing and speed is very different. So I have parked that for now.

Click the list of wellness items to choose which ones you want to get from Polar. Resting HR is taken from average sleeping HR. Sleep time is time in bed less interruptions and awake time. Sleep score is the Polar sleep score.

Sleep quality is derived from sleep score: 85+ = Great(1), 70+ = Good(2), 60+ = Average(3), below 60 = Poor(4).

The “Download Old Data” button downloads old wellness data. It takes a while so please be patient.

Tx to @Dr_Robert_D_Saunders and @Peloide for helping me test this.

7 Likes

I hold hope that polar will implement a less restrictive api in the future. The data available on the website seems easy to access and presented in json though via account credentials, though not useful for most people or normal app integration.

I downloaded my polar data and in the training session json file, longitude, latitude & time were available. Wouldn’t that be enough to create a gpx? An example of the data:

    "recordedRoute": [
      {
        "dateTime": "2021-08-09T00:00:00.00",
        "longitude": 1.12345,
        "latitude": 12.12345678,
        "altitude": 12.1
      },

I actually did write code to generate .fit files from the json data (not from the website but from the “all my data” dump). With my test workout recorded using the Polar app on my phone the altitude trace was missing and the speed trace was very different.

I could use Intervals.icu elevation correction to get altitude and use the speed “as is” but whatever I produce will not be the same as what you might see in Polar Flow.

From Polar via the API (correct I was walking and did stop a few times to look at app):

From JSON data dump:

I think the phone GPS jumps around a lot hence the high speed and Polar are cleaning this up but not providing the derived data in the JSON files.

That’s an interesting result.

I compared an activity from the following sources, JSON data dump, Polar Flow TCX export and Strava Original File TCX export.

The Polar Flow export and Strava Original export matched exactly. (Strava was in pretty print though, and I got an error when trying to upload it to Intervals: “* Request failed with status code 422”. The Polar Flow file would upload).

The following values were available in the TCX files and appeared to match exactly to the JSON file.

  • Lat / Long
  • Altitude
  • Distance
  • Heart Rate
  • Cadence

If you want to take a look at the files, I’ve uploaded them here, the password is my email address.
https://fromsmash.com/.8E2IhRQ_Y-dt

1 Like

Nice! Thanks for that.

This brings to a request for having the possibility to merge data of the same workout but coming from different devices and platforms. I pool swim with a Garmin (i.e. no HR recorded unless with the special HR band) and I record the HR with a Polar Verity OH.
This results in two different activities that I would like to merge into one. I know that Golden Cheetah does that.

It might be useful also in case of indoor bike training when comparing power from the trainer vs power from meter.

Thank you David

Thank you so much for that! :pray:

Any plans to support importing planned workouts from Polar Flow as well? :thinking:

Unfortunately from my reading of the API docs it isn’t possible to download or upload planned workouts :frowning:

@Alessandro_Cella Thats a good idea but likely quite tricky to get right. But it’s now on the list.

@Joshua Tx for that. I have downloaded the files and will have a look. Maybe just using the Polar app on my iPhone wasn’t the best test.

I’m extremely surprised Polar provides any API at all :slight_smile: For years RunGap was the only option (also it didn’t work).

Wellness data export is very nice — I grew bored a couple of months ago filling everything in, but my watch continued to gather the data. However, I notice that the import of historical data has left some blanks in HRV:

Nothing critical

Tx. Could you please redo the historical import. I have added some logging so I can see which days had data and so on. If the import is missing data I need to sort that out.

I just tried to download historical data since April 29th. The window immediately closed, not sure if anything happened.

Then I selected July 1st and there was a loading indicator:

Educated guesses: looks like there is a check that can skip data download for certain dates. Then resync is impossible if the import failed for some days

I can see some “random” failures in the logs so I have added retry logic. Will have to see if that is enough. I have also added a green “Busy please be patient” banner when you click ok. It takes a long time to get the data.

1 Like

The gaps are filled in now, thanks

1 Like

Fabulous work! Thank you very much. Syncing now.

Just signed up as a supporter through the settings link.

1 Like

Could you please mail me (david@intervals.icu) Intervals.icu links to a swim and Polar HR activity that you would like merged. Tx.

I have added support for importing your complete Polar history. Unfortunately the file formats and so on are undocumented so I need some more examples to know it is working. In particular if you are using a Polar device to record power from a power meter or running power please give this a try and send me a message. You can untick the “Import activity files” box so it won’t change anything on Intervals.icu.

Note that Polar don’t supply wellness data in the history dump but you can use the “Download old data” button for that.

1 Like

Hello @david and other.
I think I have found a bug.
I have synchronized intervals with strava and polar.
today when I have synchronized my polar, I had problems (polar fault), and I had to synchronize 2 times. Activity has been uploaded twice to intervals.icu (Strava + polar).

My theory is that in the first time the activity has been uploaded to polar and it has been synchronized with intervals.icu, and the second time I synchronized, it has synchronized with strava and has been synchronized again with intervals.icu.

Cheers

Hmm. The Polar one should have replaced the Strava one. Probably easiest to just delete one of them. Dups like this shouldn’t happen often.

1 Like

Thanks for adding the wellness information, only just noticed it was added. That’s an awesome addition!

2 Likes

One thing I noticed is that the resting HR data I added myself wasn’t overwritten when clicking on “Import old data”. To ensure consistency I deleted my manually added data but even when clicking on “Import old data” then it didn’t add any HR data for the now-empty dates.

No issue with the sleep data, that was added for all dates fine - it’s just the resting + avg sleeping HR (which I know is the same in Polar’s case) that didn’t come through properly for the dates where manual data existed.

I got around it by getting the data from the Polar API and then pushing it to the intervals.icu API myself using PUT but this might affect others as well that relied on manual data before the Polar integration was done.

Imported old data only went up to 2 weeks before today because the most recent 2 weeks are covered by normal polling. I was trying to save rate limit. I have changed this so it will fetch until today as rate limit is no longer a problem since lots of people have authed Intervals.icu. Will deploy Tues AM.

1 Like