dvmarinoff / Flux

Indoor Cycling App for Structured Training
https://flux-web.vercel.app
GNU Affero General Public License v3.0
498 stars 86 forks source link

Zwift hub one Click integration #181

Open CarlosMenke opened 7 months ago

CarlosMenke commented 7 months ago

Hey, i just got a Zwift hub one with virtual shifting, and i wanted to ask if you could implement virtual shifting of the cycling trainer, because without it is hard to use with your app?

Thanks in advance!

bttger commented 4 months ago

As far as I know, Zwift has not published any specification about the Zwift click. So we don't know how to read it (yet).

Wahoo writes "If you plan to ride in Zwift, but also in other apps like our SYSTM training app or others, the Zwift Cog will work for most applications, but because the Click only functions in Zwift, you won’t be able to shift gears. This is fine for ERG mode workouts, but for other virtual ride environments, fitness tests, or some sprint workouts, shifting is necessary. In any case, read on for other considerations."

dvmarinoff commented 4 months ago

Hey, folks, I've been slowly working on this. In another project we have the Zwift Click commands figured out and the traffic decoded. What remains is the control of the trainer. I am sceptical that Zwift/Wahoo would ever release access to the public, so this would need to be solved in a round about way. In this other project we have explored the idea to use ERG mode to Simulate virtual gears. It's working, but it needs more refinement.

In the future I'll add support here. There is actually some code in the project already. The biggest obstacle is figuring out the function that matches nicely ERG resistance to virtual gears. And the second thing is the encryption. The Zwift Click uses AEC CCM mode, but the browser has support for AES GCM mode. So I'd have to implement a small encryption library too. It's a lot of work to do all these tasks, so it will take time, but it's definitely coming.