dvmarinoff / Auuki

Indoor Cycling App for Structured Training
https://auuki.com
GNU Affero General Public License v3.0
565 stars 94 forks source link

Heart rate not working with Zwift hub #187

Open koenigderorangen opened 8 months ago

koenigderorangen commented 8 months ago

Currently trying to use the heart rate monitor with my zwift hub, which has the heart rate sensor coupled directly through the hub. Before the update this worked. Since the update, when trying to connect, every sensor is connect through the controllable (which is nice) but the heart rate stays at 0 and when I try to connect it individually with HRM it also shows "0". I've attached the log files. https://flux-dev.vercel.app/ flux-dev.vercel.app-1710957863646.log

dvmarinoff commented 8 months ago

@koenigderorangen Thanks for the report! Will investigate and get in touch tomorrow morning.

The odd thing is that my Polar H10 works connected as an hrm, and the test cases for heart rate data via the trainer also pass.

On a quick look over the logs it seems you are enabling the heart rate readings to come from trainer or device?

koenigderorangen commented 8 months ago

Thanks for the fast reply and effort! Im currently using a Wahoo TICKR through the trainer. When I decouple the HRM from my Hub and directly connect it as a HRM it works! But due to technical limitation on my side the connection is unstable and it would be great to use the coupling through the hub again. Yeah in my test i switched between the HRM from the controllable to the individual HRM but still the trainer as sensor, in hope it would work that way.

dvmarinoff commented 8 months ago

So I did try to debug this, but I currently can't figure out why it is not working.

Both the latest and the old version of Flux use the standard indoor bike data characteristic on the FTMS service to read heart rate from a trainer. This is the way it should happen by the Specification documents. The tests on the parsers pass, the simulator also works. I've changed the label for heart rate from 'hrm' in the old version to 'heartRateMonitor' in the new version, so this might require a manual switch in the settings, but according to the log you already did this and it's the right label. So I am currently out of ideas why it won't work.

dvmarinoff commented 8 months ago

NOTE: I've added the old version 0.1.43 as 'stable' version here: https://flux-stable.vercel.app/, you can fallback to it, but will need to setup heart rate source again in settings (just click it to something else and return it to the device you wish to be reading).

mgibbs189 commented 1 month ago

@dvmarinoff the Zwift Hub doesn't send heart rate values via FTMS... it uses HRS.

Don't ask me why; I ran into this issue too 😄

dvmarinoff commented 1 month ago

Hey @mgibbs189 Thanks for the tip! Indeed unexpected.

dvmarinoff commented 1 month ago

OK, I think I found the issue. The Heart Rate Service needs to be added to the bluetooth request filter, else the service won't appear in the primary services list. I added it as an optional service to the filter and it passes testing with a simulator that has FTMS trainer control and Heart Rate Service.

The fix is live on version 0.1.50 on https://flux-dev.vercel.app/

NOTE: you'd need to turn on heart rate from the controllable in Settings

dvmarinoff commented 1 month ago

Latest fix is in production on 0.1.60, just need someone with an access to Zwift Hub trainer to confirm it works.

koenigderorangen commented 3 weeks ago

Reporting back, I can confirm that the connectivity issue with my Zwift Hub is no longer a problem. Thank you very much for your dedication—you made my day! :) I will close the issue in the coming weeks if I can confirm it stays working during the next sessions.

dvmarinoff commented 2 weeks ago

Nice, thanks for the feedback!