Thursday, November 03, 2011

Uploading Old Polar HRM Data to the Polar Personal Trainer Website

(Update 30th April 2012: Newer version of the HRMUploader jar that fixes, hopefully, altitude data.)

I'm a keen cyclist and have used a Heart Rate Monitor of various descriptions for a number of years. I've religiously downloaded this data onto the PC and stored it in the various applications that come with the monitor. Not that I do anything with it, though I did get part way through writing an application to store the data in a relational database and then display multiple rides overlaid on one another for visual comparison. Anyway, I digress.

More recently I've bought Polar HRMs, they are great products with useful features for cycling. Years ago I wrote a Java application that converted the 'other' HRM files to the Polar format, so that all rides and associated HRM data could be shown in the latest Polar application on the PC.

Polar have caught onto the web, and have launched a site that allows you to transfer your data from the HRM to the web. Great for current stuff, but what about all those old files I have? In their wisdom, Polar have not released a tool that allows me to upload the data I've got on my PC.

There are a few people around who would, like me, prefer to have all their data on the web, and want to upload their old data. Being a professional Java developer, I thought it would be a doddle to create a Java Application that interfaced with the Polar web site and allowed me to transfer my data. And, in general, it was. So here is a Java application that does this. It's a little crude, but does the job.

Just run it with:

java -jar HRMUploader.jar


Enter your Polar Personal Trainer userid and password. If you log in successfully, then you will see your name in the lower status pane.

Browse to your polar .hrm files and select one or more (try it with one first :) ) The application will check the site to see if it's already uploaded a file for this date. If it has, it will put a check mark against the file, if it hasn't then use the upload button to upload the file. It won't upload a file that is already on the site, you will have to delete it from the site if you want to resend it.

There are no guarantees that this will work for you. Might be worth opening another 'test' account on the Polar site and trying it out there first. Whilst you can select many files to upload at once, it might be worth limiting it to 10 or so at a time - the Polar site might choke on too many. I just tried it with about 70 and it took a while, but seemed to work.

Regarding calories expended.

This value is read from the associated PDD file and needs to be in the same directory as your HRM file.  There's one PDD file for each day, so you could have many HRM files that reference the same PDD if you do multiple exercises per day.  In these cases, you are unlikely to be able to read the PDD as it will not have the same name as the HRM file.  Unfortunately, when I originally wrote the HRMUploader, I didn't realise I needed to read the PDD too.  Ideally I need to change the application to read the PDD first,  since this contains all the HRM file names.  However, I'm not planning to do this any time soon, sorry.

Altitude data

Altitude data is sent to the Polar site in 'feet'.  This means that if you are using meters in your HRM file, then the conversion to and from feet could result in a rounding error.

Furthermore, I seem to recall a bug in the HRM files that stores altitude as feet, even though the file is supposed to be metric.  Send me a HRM file example if you suspect the altitude is being uploaded incorrectly.


At some point I'd like to host this on the Google Java App Server, but they've done some funny stuff with Java and restricted various classes in the default 'JRE'. It means that some stuff which should work under Java's WORA mantra doesn't.

The application uses various libraries from Apache, Google and Castor. All their respective rights are recognised. The software is supplied 'as-is' and you use it at your own risk. You did back that data up, right?

67 comments:

Michael said...

Does this app still work?
Seems like I get an error message

(error code not possible to paste)

Not sure if I'm doing anything wrong

Curly said...

Just tried it and it seemed to work OK (well, it logged in OK). I don't recognise the error message you wrote, so I don't think it's one of mine :)

You will need a relatively upto date version of Java.

When you run it do you get the login prompt?

Can you login?

If you run the app from the command line, then look at the messages it prints.

Feel free to email me [polar at softwyer.com]

cbosso said...

This was exactly what I needed! Thanks for throwing it together.

Chris

SO said...

Hi, I get an error message after clicking Upload (log copied from command prompt), that is when I try to upload the one file I've selected.

xception in thread "Thread-4" java.lang.NullPointerException at com.softwyer.bike.imports.RidePolar.getAscent(RidePolar.java:376) at com.softwyer.hrmuploader.webservice.WristUnitDataFactory.prepForMarsh
al(WristUnitDataFactory.java:121) at com.softwyer.hrmuploader.webservice.WristUnitDataFactory.createWristUnitData(WristUnitDataFactory.java:36) at com.softwyer.hrmuploader.FrameController.uploadFiles(FrameController. java:255)
at com.softwyer.hrmuploader.FrameController$2.run(FrameController.java:103)

Curly said...

"SO", you might have a config file for a monitor I've not tested against. Can you send the HRM file to me at polar at softwyer.com.

Thanks, might be a day or so before I can get around to looking at it.

Ania said...

Hi,

this is my error when i try to run the program:
C:\>java -jar HRMUploader.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/softwyer/
hrmuploader/HRMUploader (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

Curly said...

Ania,

It looks like you are using an older version of the Java Runtime. Make sure you are using Java 1.5 or later.

You can check by typing:

Java -version

from the command line. Later versions can be downloaded from the http://java.sun.com/javase/downloads/index.jsp

Brandon said...

This worked like a champ for me, thanks so much!

Ivan said...

Thank you so much! Greetings from Croatia!

Paulo said...

Thanks so much for the app. It worked like a charm!

Berend De Schouwer said...

Everything seems to work, but the file doesn't show up.

INFO: Status is: Status code is <500>, message is <20110106-6>
Received response: com.softwyer.hrmuploader.webservice.Webservice@b2e752

Curly said...

Hi Berend,

Error 500 indicates that there's been a server error (i.e. the Polar
website choked).

There is probably something in the file that it doesn't like; possibly
I'm translating the file incorrectly.

If you would like to send me the .hrm file, then I'll see if I can
find the problem and fix it.

Regards,

Karl. (polar at softwyer.com)

The Electronic Trendline said...

Hello Curly,
Thanks so much for making this app. I am able to upload my HRM file from ProTrainer5 and I see it in my polarpersonaltrainer.com diary but it lacks the calorie expenditure info and if I input it manually on the polarpersonal site, its not recognized for the challenges. I can see the calories burned with ProTrainer software it just isn't appearing on the personaltrainer website. Any Ideas?

Curly said...

@TheElectronicTrendline.

If you email one of the HRM files, then I'll have a look for you. Although, having looked at the ones I uploaded from a CS600, they don't show the calories expended either.

I'll have to debug the web uploader to see how it sends the data, might take me some time though...

karl (polar at softwyer.com)

beckk said...

Hello

really nice application,
but I have also the problem with calories at the online diary.
Is there also a way to upload the polar pdd files?, because I have got some exercises which are without hrm files.
It would also be fine if I can get the java sources :)

kind regards
klaus

Mannemussla said...

Found this post and it seems great :-) I do not have a .hrm file but I have a lot of trainging data that I would like to upload. Any chance it would be possible for me to set for example a comma separated file up containing info regarding:
Date, Distance, Duration, Avg pace, Avg speed, Burned Calories, Climb, Avg. heart rate, Max heart rate, Training Name, Sport etc. and use your app?

How would the file then be set up, if possible?

Any feedback from Polar by the way?

Curly said...

@Mannemussla

I'd look for something that can convert the files you have to the Polar .hrm format. This way you can use the uploader as-is.

There are a few applications out there that do this, but depending upon what files you have, you may have to hunt around for it.

Failing that, you could always convert it yourself. The Polar file spec is available online here -> http://www.polar.fi/files/Polar_HRM_file%20format.pdf

Mannemussla said...

Thanks a lot :-) I will look into both alternatives.

CrossCombo said...

Great work Curly, this is what I've been waiting for for a long time!

But, when I compare my HRM data file in Polar Protrainer 5 with the result on the web (polarpersonaltrainer.com), it doesn't match. The distance is wrong (11 km instead of the correct 10,6 km), the HR zones are close to correct but not right on the money, and some other small differences... It might be that I use comma instead of a dot as a seperator, that might mess up the export, but I don't know...

I could send you a couple of my HRM files if you'd like to se it for yourself, or, you could send me the source code and I'll check it out for myself...

Thanks

/Stellan
Stockholm, Sweden

Curly said...

Hi Stellan,

Send me a couple of files and I'll have a look over the weekend. It's possible that I'm rounding a few values up too much.

Karl

Unknown said...

I have a problem with some of my uploaded files.

The workout shows up in the polarpersonaltrainer.com diary with the correct information shown. When I try to open the training session it only states "Load Error: error" and my only option is to "Return to Diary".

This happens to approximately 50% of my *.hrm files that I uploaded. I can't find anything that the erroneous exercises have in common. None what so ever.

Has someone else encountered this?

Curly said...

@Unknown

No one else has reported a problem with viewing a HRM file uploaded from the application.

Some thoughts/questions:

Does it happen every time with the same file(s), or is it random?

If you delete one of the problem exercises from the Polar site and upload it again using the application, does it still show the load error? If it does, then send one of them to me (polar at softwyer.com) and I'll see if I can isolate the problem.

Curly.

Esa said...

Hello,

Thanks for the app.

I tried to upload (polar xtrainer plus) HRM files.
Logged in OK, but the upload was unsuccessful.

Messages I got:
Problem during validation:null

INFO: Status is: Status code is <500>, message is ...


What could be the problem?


BR,
Esa

Curly said...

@Esa

Post a copy of a HRM file to polar @ softwyer.com and I'll have a look at it.

Benja said...

Hi
Thanks for a great program.

Everything works great and I get the message "Finished uploading Polar Files". But when I log on to polarpersonaltrainer.com I cant see the uploaded exercies anywhere.
Do I have to do anything before they show up ?

Thanks

Benja said...

Just found out that when I get the message "Finished uploading Polar Files" there is no check mark in front of the files I have just uploaded. Is this because the upload didnt go well ?

Curly said...

Benja,

THe tick indicates that the file was uploaded OK. It should appear in your training diary under the date of the exercise (not today's date).

If it still doesn't appear, send me a hrm file and I'll try it. polar @ softwyer.com

Jérémie R. said...

Hey man,

thank you for this great job.

Idrive said...

Thanks a lot I could update all my old .hrm files. That's great ! The only thing is that data for altitude and pace/speed looks erroneous in the polarpersonaltrainer website when looking at the graph versus time. Averages in the data tab look instead correct for all parameters. Can you explain why do I have that ?

Thanks so much anyway, great job !!
Guido

Idrive said...

correction from my previous post. Also average data from the data TAB in polarpersonaltrainer look wrong except for the HR data.

Curly said...

@Idrive

There may be issues when uploading some HRM files from devices I haven'y seen before. Best thing to do is send me a copy of the HRM file and I'll have a look to see what the issue is. Email polar at SoftWyer.com

Just_Quackers said...

Thank you for making such a wonderful app. Worked painlessly quick from some old hrm files.

However, the avg mph and max mph listed are way off. (like 117 mph!) The speed in the graph is right though. I used a 720i bike heart rate monitor.

Carlos said...

Great effort Curly. I really apreciate that someone out there shared something like your app.

The app worked almost without any issues for the files generated from a S725x, but the calories issues is present on the files generated from a S810 (it may be because the ProTrainer version was older then).

Now I can get all my information in a single place since I've upgraded to a RCX5, thanks to you.

I can't believe that Polar people haven't done everything about it. You should contact them to give them some piece of advice or sell your uploader to them.

Thanks again!

Cameron said...

Curly you are a star. Just uploaded 5 years of S625X data. I am a stat junky so very pleased.

The only issue seemed to be that it didn't pick up the sport. It got the rest of the annotation as far as I can tell.

Thanks v v much. Amazing that Polar.fi don't buy this from you and offer to all parties. Creates much more loyalty. I might go for the Polar RCX5 over the Garmin 910XT after all this Christmas!

Marinho said...

Excellent job! Thanks for creating and sharing this application.

Like many unspoken users, I have tons of previous hrm data which I can afford to miss. In my case, thousands of files created since 2004, all generated by a diversity of Polar watches, and now the company tells me that I cannot upload them to the site, one that I am obliged to use since I bought a RCX5. Unfortunately, I'm having issues with the application, which seems to get stuck. BTW, I suggest adding some kind of visual feedback to tell how many files have been uploaded so far. Congrats, Marinho.

Curly said...

@Marinho

Try the latest version, it fixes some issues with uploading HRM files that use R-R recording.

If you still have problems, then email me a few of your problematic files and I'll investigate.

Regarding adding progress, it's not that useful as all the files are sent at once in one call :-)

finepl said...

My company rewards exercise with Virgin HealthMiles, which parters with polarpersonaltrainer.com for uploading .hrm files. Your java app, combined with TCX converter, allows me to get credit for my Garmin GPX data from my Edge 705. Thanks a bunch!

Unknown said...

Great app! Polar shoud do something like this years ago!

One question: did you also consider uploading the GPX data? PPT.com only imports GPX from RCX5(and one more which I don't remember the name). Unfortunately I have RS800CX and PPT.com doesn't import GPX data.

Curly said...

@Unknown

If you can save/convert the file to a HRM format, then this application should be able to upload it.

Markku said...

The issue with GPS data is that Polar saves HRM data and GPS data into separate files on local PC. So to upload them into web site requires some understanding of the data exchange to upload also gps data...

Curly said...

@Markku

Does the Polar WebLink application upload this data? (goo.gl/beHKZ)

If so, you can use an intercepting proxy to capture this data and send it to me. This is a good one -> goo.gl/d4s49

Markku said...

I have RS800CX and WebLink does not upload gpx data. I think that Polar WebSync app uploads also gpx data, but I don't have a compatible device for that (RCX5 or CS500). WebSync does not support RS800CX.

My understanding is that also RCX5 and CS500 store gpx data into separate file if data transferred locally from wristunit into PPT5.

jogger said...

It works fine for most hrm files, but not for files containing norwegian characters æ,ø and å.
Any hope for a solution?

Curly said...

@jogger

Could you send a .hrm file to polar@softwyer.com and I'll investigate. Thanks.

Curly said...

@Markku

Thanks for the information. Looks like WebLink doesn't support GPS thus I can't upload it.

Linus Nikander said...

Would you consider sharing the source for the app ?`I've been thinking about writing an app to do the same as HRMUploader but in the guise of a web-app instead. I could write it all from scratch but it seems like a waste of time to re-write the parsing that you already have up and running. Naturally I'd credit you for that part of the code.Mail me at linus[at]nikander.net if you'd consider sharing.

Curly said...

Hi Linus,

The code is, unfortunately, integrated into another application and not easily extracted.

However, the code that handles communication and data upload to the Polar site is fairly self contained, being in a simple Java class. If you are interested in this, then I'm happy to share this - just email me -> polar at softwyer.com

Marinho said...

First, thanks for creating this app and sharing it. I have tons of hrm files to upload to PPT.com and it would be extremely useful to be able to upload them. However, the app is halting... there seems to be a problem in the parser while processing a string. An exception occurs when I run with some files. I'll send you the error message and the "offending files", if you could have a look at it. Cheers, Marinho.

dezdong said...

Thanks very much Curly. Just uploaded a few years worth of files from a S725X with no issues.
Great!!!!!!

Palle said...

Thanks, this is perfect.

finepl said...

Worked great last year. Using files from Garmin 705, converted to .hrm using GPX converter. Unfortunately, this year, I am getting this error:

Problem during validation: 5

This occurs even with files that I successfully loaded last year. This year I am using 10.7. Last year 10.6. Any changes to the Apple Java implementation?

Curly said...

There shouldn't be anything in the uploader that would cause issues with Java on Mac OSX. I seem to recall that you can switch between different versions, so make sure that you are using the latest JRE (Applications -> Utilities - > Java -> Java Preferences)

finepl said...

I am currently using the latest JRE. I have also tried uploading .hrm files generated by my Polar 720i and am getting Problem during validation: 4.

Can I get a version of your code without validation? The whole functionality of verification seems broken.

Curly said...

Hmm, there's no validation in the code. The only security related code is to do with this login to Polar. It doesn't sound like this is the problem you are experiencing.

If you can run this software from the command line/shell (java -jar HRMUploader.jar) and send any error/stack trace to polar@softwyer.com, then we may see something we can fix.

finepl said...

This command

java -jar HRMUploader.jar

will not run from the terminal in OS X. It returns the following:

Invalid or corrupt jarfile HRMUploader.jar

finepl said...

BTW, my problems occur during file selection, before hitting the upload button.

finepl said...

I sent you some sample .hrm files, as well as screen shots of the errors, and console log messages.

toremj said...

Just what i needed! Working great!

Curly said...

@finepl Hmm, not received any files yet. Can you resend?

finepl said...

Thanks for updating hrmuploader. Everything works again.

sigurde said...

Is it possible to upload HRM files created in Tacx Fortius with HRMUploader? It used to work fine with Polar Pro Trainer 5, but I receive this error message when trying to upload with HRMUploader:

INFO: Status is: Status code is <200>, message is
Processing Collection: exercises
Processing Collection: tests
The action event was: java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=Upload,whe
n=1332196602885,modifiers=Button1] on javax.swing.JButton[,399,222,73x26,alignme
ntX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUI
Resource@215f7107,flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon
=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[t
op=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,ro
lloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Upload
,defaultCapable=true]
Exception in thread "Thread-5" java.lang.NumberFormatException: For input string
: "21,1"
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at java.lang.Double.valueOf(Unknown Source)
at g.g(Unknown Source)
at ab.a(Unknown Source)
at ab.a(Unknown Source)
at l.ai(Unknown Source)
at n.run(Unknown Source)

Curly said...

Try downloading the the latest HRM Uploader file. It was changed a few days ago to fix some problems with malformed HRM files.

If it still doesn't work, then email me a HRM file and I'll check it (polar at softwyer.com)

Curly said...

Ah, scratch trying it, I can see you are using the latest download. Just email the HRM file :-)

Visningsnavn said...

Nice piece of work! Only missing is GPS data from my CS600x but no big problem. I've got all my history now :) Thank you very much.

MeesJookseb said...

Well done!

kWh said...

Brilliant!!! Thanks for sharing this excellent tool!

Hanskabans said...

Thanks a lot for your development. Is there a way to get calories and distance shown? I´m using RCX5 and the data does not show these features and recognizes a Polar CS600. But anyway, thanks for your effort.

Post a Comment