Giter VIP home page Giter VIP logo

polar-rcx5-datalink's Introduction

polar-rcx5-datalink

Command-line program to export Polar RCX5 training sessions in raw or tcx format. You also can upload them to Strava with a single command.

Table of contents

Requirements

  • Python >=3.7
  • libusb >=1.0, <=1.0.21 (PyUSB has issues with libusb-1.0.22 backend.)

If you are using Linux, chances are your distribution already includes libusb.

How to install libusb on Windows: pyusb/pyusb#120 (comment)

Installation

pip install polar-rcx5-datalink

Usage

  1. Plug in Polar DataLink
  2. Select "Connect > Start" from your watch
  3. Run a command

Examples

Export training sessions in current directory

rcx5 export

Export training sessions to /where/to/export/files/

rcx5 export --out /where/to/export/files/ --format tcx

Filter by date

rcx5 export --from-date 2018-11-20 --to-date 2018-11-25

Sync training sessions with Strava

rcx5 stravasync --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET

Description

Usage: rcx5 [OPTIONS] COMMAND [ARGS]...

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  export      Exports training sessions.
  stravasync  Helps to synchronize training sessions with Strava.

rcx5 export

Usage: rcx5 export [OPTIONS]

  Exports training sessions.

Options:
  -o, --out PATH                  Where to save the output. Current working
                                  directory by default.
  -f, --format [raw|bin|tcx]      Export file format. [default: tcx]
  -s, --sessions-dir PATH         Directory of raw training sessions.
  --from-date [%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d %H:%M:%S]
                                  Filter sessions that have started at this
                                  date or after.
  --to-date [%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d %H:%M:%S]
                                  Filter sessions that have started at this
                                  date or before.
  --help                          Show this message and exit.

rcx5 stravasync

Usage: rcx5 stravasync [OPTIONS]

  Helps to synchronize training sessions with Strava.

  Before getting started you need to register an application
  https://strava.com/settings/api (Authorization Callback Domain MUST be
  0.0.0.0).

  A registered application will be assigned a Client id and Client secret.
  Provide those in options --client-id and --client-secret respectively.

  Examples:
    rcx5 stravasync --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET

    # You can use environment variables to pass --client-id and --client-secret.

    export RCX5_STRAVASYNC_CLIENT_ID=YOUR_CLIENT_ID
    export RCX5_STRAVASYNC_CLIENT_SECRET=YOUR_CLIENT_SECRET
    rcx5 stravasync

Options:
  -h, --host TEXT
  -p, --port INTEGER
  --client-id INTEGER             Application’s ID, obtained during
                                  registration  [required]
  --client-secret TEXT            Application’s secret, obtained during
                                  registration.  [required]
  -s, --sessions-dir PATH         Directory of raw training sessions.
  --from-date [%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d %H:%M:%S]
                                  Filter sessions that have started at this
                                  date or after.
  --to-date [%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d %H:%M:%S]
                                  Filter sessions that have started at this
                                  date or before.
  --help                          Show this message and exit.

polar-rcx5-datalink's People

Contributors

purpledot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

polar-rcx5-datalink's Issues

polarpersonaltrainer.com ended

@purpledot
I found your project searching for possibilities to use my CS500 after polar ends the service.

Will your project still work after they shut down their servers.

Polar-rcx5-datalink ... will this also work with two CS500?

"Insufficient permissions" error on Mac

Hi, does anyone maybe have advice. I am trying to run rcx5 export using python 3.8.2:

  • I manually installed libusb 1.0.21 (as suggested), from source using configure && make && make install. The brew install libusb unfortunately installs 1.0.23, so I uninstalled it.

While I get a similar error trace as #8, my trace ends with

 ...
  File "/Users/jwjoubert/.pyenv/versions/3.8.2/lib/python3.8/site-packages/usb/backend/libusb1.py", line 811, in claim_interface
    _check(self.lib.libusb_claim_interface(dev_handle.handle, intf))
  File "/Users/jwjoubert/.pyenv/versions/3.8.2/lib/python3.8/site-packages/usb/backend/libusb1.py", line 595, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 13] Access denied (insufficient permissions)

Any advice, please? I'm attaching the whole error log too.
error.log

I did try sudo rcx5 export, but to no avail.

Install on Raspbian

Hope this helps someone;

Had to install this on raspbian by using:

sudo pip3 install [path to downloaded package]

Then run sudo rcx5 export made a working connection to export my logs.

invalid tcx file

Good morning,

I recently bought an rcx5 :-)
The app runs well but the generated tcx file is wrong with dummy values.

In attached I put both hrm and gpx from websync, the tcx file generated by your script and the tcx file generated by https://polarconverter.com/

TCX_genration_issue.zip

I'll try to investigate what could be wrong on the parsing side.

Thank's again for your work ! It will get a lot of watches out of the trash and could prevent a lot (I hope) of electronic waste !

TCX_genration_issue.zip

Trying on RCX3 GPS data not detected

Good morning,
thanks for that work which will keep living a lot of great rcx watches after the end of polar personnal trainer.
I try it over my rcx3 and I face an issue. bin and json export work but tcx does not : 2018-11-25T10:02:41 has no GPS data
But it does, from a G5 GPS. I attached the bin and raw exported files
20181125T100241.zip

Thanks again.

missing backend

Any help for this available?

Traceback (most recent call last):
File "/Users/bartjonk/ENVS/polar/bin/rcx5", line 10, in
sys.exit(main())
File "/Users/bartjonk/ENVS/polar/lib/python3.7/site-packages/polar_rcx5_datalink/cli.py", line 214, in main
cli(auto_envvar_prefix=ENVVAR_PREFIX)
File "/Users/bartjonk/ENVS/polar/lib/python3.7/site-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/Users/bartjonk/ENVS/polar/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/Users/bartjonk/ENVS/polar/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/bartjonk/ENVS/polar/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/bartjonk/ENVS/polar/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Users/bartjonk/ENVS/polar/lib/python3.7/site-packages/polar_rcx5_datalink/cli.py", line 130, in newfunc
return func(*args, **kwargs)
File "/Users/bartjonk/ENVS/polar/lib/python3.7/site-packages/polar_rcx5_datalink/cli.py", line 85, in wrapper
raw_sessions = get_raw_sessions(kwargs.pop('sessions_dir', None))
File "/Users/bartjonk/ENVS/polar/lib/python3.7/site-packages/polar_rcx5_datalink/cli.py", line 49, in get_raw_sessions
raw_sessions = raw_sessions_from_watch()
File "/Users/bartjonk/ENVS/polar/lib/python3.7/site-packages/polar_rcx5_datalink/cli.py", line 65, in raw_sessions_from_watch
dl.synchronize()
File "/Users/bartjonk/ENVS/polar/lib/python3.7/site-packages/polar_rcx5_datalink/datalink.py", line 54, in synchronize
self._connect()
File "/Users/bartjonk/ENVS/polar/lib/python3.7/site-packages/polar_rcx5_datalink/datalink.py", line 96, in _connect
self.dev = usb.core.find(idVendor=0x0DA4, idProduct=0x0004)
File "/Users/bartjonk/ENVS/polar/lib/python3.7/site-packages/usb/core.py", line 1263, in find
raise NoBackendError('No backend available')
usb.core.NoBackendError: No backend available

tcx files don't map correctly

Tried uploading the TCX file output to Strava, but the GPS coordinates are incorrect (Has me cycling in the sea :) )

RCX3

Hello,

Is it possible to use this utility for the RCX3?

best regards
Manuel

Parsing error when exporting

Hi thanks for the code , I really appreciate it.

I'm getting parsing error when exporting.

I suspect the parsing error is due to me not having a gps. Attached are the error log and the json file. It's just a short 2 minutes test with just the HRM.

Thanks.

error.log
20191227T232525.json.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.