Feature Request - TrainerRoad API

Following on from my post about getting Philips Hue lights to show the TR current power colour value:

it seems clear that nothing can be done without some sort of API from the TR side of things, which as far as I know isn’t available yet.

A couple of replies have pointed out other really neat features that would become possible, so I just wanted to reach out to the TR team @Nate_Pearson and see if its something that they’ve thought about implementing and if its on the timeline for the future.

1 Like

Hey there! I’ve forwarded your feature request to our team, but can’t answer whether we’ve thought about or are implementing an API. Hopefully Nate chimes in, but if not, rest assured that your request has been brought to the planning and product management team’s attention. Cheers, and good luck with the new gym!

Thanks Larry, much appreciated!
There may be loads of cool things that could be developed on the side by a talented programming community using an API, leaving the TR development team free to concentrate on what they do best…providing the most effective training platform out there! :sunglasses:

We want to do a workout APi someday, that’s in the backlog.

You’re talking about a live api which is a little more tricky…and a little easier. I don’t see a big use for it at the moment.

The idea is cool though. I think I would make the room RED during the hard intervals and regular light via recovery.

That’s the beauty of API’s @Nate_Pearson, you don’t have to envision the end state, the API will drive innovation beyond anything you can think of sitting in the board (bored) room. Build it and they will come…

5 Likes

Very true.

1 Like

Yes, exactly what I was thinking.
My idea is quite niche, but the API opens up the possibility of hundreds of niche ideas being possible, customising TR to make it even better!

Thanks for taking the time to reply @Nate_Pearson, really hope it’s sonething that will be looked into when you guys get time.

Keep up the awesome work :clap:

Do you need a TR API or could you use an additional Ant+ dongle and Ant+ & Hue libraries directly?

3 Likes

You could color code by power number (and maybe compare that to FTP to decide what’s easy and what’s not… although you’d have to keep the controller updated with your current value), but wasn’t adherence to the power target being discussed? You’d have to know the workout details, and be synced with the run time of the workout (no pauses etc.).

There’s a lot you can do without a TR API, and some things that are hard.

If there was an API, I would expect TR could just send the direct colour code out that it uses to colour the little bar under the current power to let you know if you’re on track.

Interesting point made by @rchristie …never thought of that. I guess the ant+ broadcast will contain the TR target power, you could also then pick up the current power from the Powertap pedals, and then work a quick calculation to sort the required colour to change the lights.
All of which would need to be programmed and made talk to hue of course…I wish I was a programmer!!!

I was just thinking last night if the API did become a reality, TR could have their own “App Store” with add ons made by contributors and vetted by TR to ensure quality. Seems like a win win, as it may bring features that have never even been thought of, with no development costs to TR, other than the initial API development.

I love the idea of an API for some post-ride processing. For the original idea from @bsharp77 Optical Character Recognition might serve as a good workaround in the meantime. The clean TR interface should give you consistent results.

@Nate_Pearson Consider using a technology like Kafka for a live streaming API. Either that or maybe a webhook implementation.

The power target is broadcast to the trainer in ERG mode, and the trainer broadcasts the actual power. You just want to sit and listen to the ANT+/BT traffic and do things from it. Taking that tack makes it app-independent (would work in Zwift/Rouvy/Tacx/TR workouts).

1 Like

Not very relevant to the original question, but if you do some sniffing of how the app/website talks to the backend, you should be able to figure something out.

I hacked together an app for my Garmin Fenix which shows me my next workout details.

Also, as I don’t use strava, but do want my wahoo element rides uploaded to TR, I’ve created a Zapier app to upload rides to TR.

If anyone is interested, I can share the code. Please note that as there is no official API, things might break at any time.

image

2 Likes

I’d like to take a look at that if you’re willing to share.

Yes, that would be interesting! I’d be very happy for a Github link or something like that :slight_smile:

1 Like

I’ve used this integration with Z***t’s API and it works great. Be cool to get sometihng similar for TR. Currently use it set fan on/off states, speed etc and change lighting colour.

Hi all,
just an idea. A bit different way to implement bsharp77’s idea: why not to listen for power data directly? For example using a devkit and SDK from Nordic Semiconductor it should be possible to listen to ANT+ power data and perform actions based on the data. Or use an ANT+ USB dongle and a Raspberry Pi instead, so you will have network connectivity too.

But yeah, I like the original idea too, an API would be great to have.

Hey guys, I can guarantee you’d be able to do it with a setup like this:
-Raspi Zero W running NodeJS
-Use bleno to create a FTMS-compatible characteristic - you’d only have to expose and implement ERG
-Use noble to listen to your powermeter output (or if you’ve got a smart trainer, to pass along the erg commands to it) and make like your fake FTMS trainer is outputting that power.
-Now you’ve got the live erg target (thanks to TR sending FTMS commands to your fake trainer) and the current power (thanks to listening to your PM). Just find an appropriate API to control your lighting system.

Necessary NPM packages:
-philips-hue - npm - for controlling Philips Hue - note: I haven’t used this package, but seems like it’d do what you need.
-Bleno - For creating a fake BLE peripheral
-Noble - For acting as a BLE central and listening to other peripherals like your PM

Necessary Docs:
-FTMS Specs PDF
-BLE Cycling Power Service

Total cost would be about $50 for the raspi zero W + case + dongles + power supply. You could do it with a raspi 4 as well for a bit more CPU oomph and ease of development. The zero ain’t quick.

I’ve done a ton of playing about with Raspi’s and BLE, this would work.

1 Like