Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apple Watch Heart Rate using the iPad #957

Closed
cagnulein opened this issue Sep 29, 2022 · 24 comments
Closed

Apple Watch Heart Rate using the iPad #957

cagnulein opened this issue Sep 29, 2022 · 24 comments
Assignees
Milestone

Comments

@cagnulein
Copy link
Owner

Broadcasting via UDP the HR from the phone to the ipad, we should be able to get the HR into the iPad directly. The ipad should answers back with the kcal and the distance at least.

@cagnulein cagnulein added this to the 2.11 milestone Sep 29, 2022
@cagnulein cagnulein self-assigned this Sep 29, 2022
@cagnulein
Copy link
Owner Author

I requested a Multicast Networking Entitlement https://developer.apple.com/contact/request/networking-multicast

@cagnulein
Copy link
Owner Author

@cagnulein
Copy link
Owner Author

@cagnulein
Copy link
Owner Author

UIDevice.current.userInterfaceIdiom == .pad
UIDevice.current.userInterfaceIdiom == .phone

@cagnulein cagnulein reopened this Sep 30, 2022
cagnulein added a commit that referenced this issue Oct 2, 2022
@RickNY
Copy link

RickNY commented Oct 2, 2022

Log files from iPhone & iPad - no HR from watch. Watch was displaying HR. iPad was linked to tread, but not displaying HR.

iPad_debug-Sun_Oct_2_13_21_33_2022.log.txt
iPhone_debug-Sun_Oct_2_13_21_33_2022.log.txt

@cagnulein
Copy link
Owner Author

@RickNY i checked the logs. I guess maybe i found why you're not seeing it. I'm updating the heart tiles only when i receive some metrics from the treadmill. So try to do the same but also starting the treadmill.
Let me know

@RickNY
Copy link

RickNY commented Oct 3, 2022

@RickNY i checked the logs. I guess maybe i found why you're not seeing it. I'm updating the heart tiles only when i receive some metrics from the treadmill. So try to do the same but also starting the treadmill. Let me know

Maybe I'm misunderstanding -- the iPad was receiving metrics from the treadmill in that previous log.. I've attached two more just in case

Sun Oct 2 13:23:47 2022 1664731427524 Debug: /Users/cagnulein/qdomyos-zwift/src/bluetooth.cpp void bluetooth::debug(const QString &) "Current Speed: 0.80467"
Sun Oct 2 13:23:47 2022 1664731427526 Debug: /Users/cagnulein/qdomyos-zwift/src/bluetooth.cpp void bluetooth::debug(const QString &) "Current Inclination: 0"
Sun Oct 2 13:23:47 2022 1664731427527 Debug: /Users/cagnulein/qdomyos-zwift/src/bluetooth.cpp void bluetooth::debug(const QString &) "Current KCal: 5.11463"
Sun Oct 2 13:23:47 2022 1664731427529 Debug: /Users/cagnulein/qdomyos-zwift/src/bluetooth.cpp void bluetooth::debug(const QString &) "Current Distance: 0.02297"
Sun Oct 2 13:23:47 2022 1664731427530 Debug: /Users/cagnulein/qdomyos-zwift/src/bluetooth.cpp void bluetooth::debug(const QString &) "Current Heart from Apple Watch: 0"

iPad-debug-Mon_Oct_3_06_32_33_2022.log.txt
iPhone-debug-Mon_Oct_3_06_31_22_2022.log.txt

@cagnulein
Copy link
Owner Author

sorry @RickNY you were right, i probably checked the iphone log instead of the ipad one.
Ok let's try to understand this. This morning I saw an issue about this feature that maybe it's the same that you're facing.

The problem is: if you close one app (iphone or ipad) you have also to close the other one. I mean, it works only if they starts from a clean session. Of course it's something that I have to fix.

So in order to do so, let's do in this way:

  1. open qz on the ipad and full close it with the swipe
  2. do the same thing on the iphone
  3. start again qz on the ipad and let it connect to the treadmill
  4. start the workout from your apple watch

in this way does it work all the time? On my end yes, so it should works to you too.
In the meantime I'm trying to fix the desync when you close a side.
Thanks

@cagnulein cagnulein reopened this Oct 3, 2022
@RickNY
Copy link

RickNY commented Oct 3, 2022

I’ll try this in the order you specified - I’m pretty sure I had tried those combos, and also swiped away the watch app on the phone as well. I’ll get back to you.

@cagnulein
Copy link
Owner Author

ok thanks @RickNY
the problem that I have now is that the debug log inside the apple watch thing are not redirected to the qz log. I'm also adding this thing in order to fully understand everything

@cagnulein
Copy link
Owner Author

ok i fixed the problem that I saw this morning. I hope it will fix also your issue. I'm sending you another one later today @RickNY

cagnulein added a commit that referenced this issue Oct 3, 2022
@RickNY
Copy link

RickNY commented Oct 3, 2022

OK, got a little closer with the update that came.. I was getting heart rate initially -- but it stopped updating on the iPad.. iPad kept reporting 70, it changed a few times but stopped updating after maybe a minute or so.. The QZ app on the watch was showing the correct HR the entire time.

These should be the logs from that..

iPhone_debug-Mon_Oct_3_17_44_16_2022.log.txt
iPad_debug-Mon_Oct_3_17_43_55_2022.log.txt

@cagnulein
Copy link
Owner Author

@RickNY Did you check also the distance and kcal on the watch? They stop too?
Today I will work on creating on a better debug log for this

@RickNY
Copy link

RickNY commented Oct 4, 2022

Sorry I wasn’t clear with last sentence - watch was updating properly entire run.

@cagnulein
Copy link
Owner Author

@RickNY hah so it means that iphone is getting the metrics from the ipad correctly. it's just the ipad that it sometimes lost the connection from the iphone.

@RickNY
Copy link

RickNY commented Oct 4, 2022

OK... Just decided to try something on a whim.. Did a "Reset Network Settings" on both the iPhone & iPad.. Now, it seems to be working -- BUT -- I may have been missing an important step before (DUH). I dont think I was manually launching QZ on the phone -- I was making sure it was closed so it wouldnt latch on to the BT connection to the tread -- and thinking that launching the watch app by itself was also opening the app on the phone. So -- here is what is working:

  1. Swipe/close app on iPad and iPhone
  2. On tread, I set my profile name, weight and start manually
  3. Immediately open QZ app on iPad
  4. Open QZ app on iPhone <-- was missing this step
  5. Open QZ app on watch and choose workout type and click Start
  6. HR appears after around 5-10 seconds on iPad
  7. Tread finishes init after 30-40 secs

Since its raining today (and cold) - I'll be doing my workout on the tread later today.

Also - I'm going to open another feature request - but I think should be easy -- is it possible to include elevation gain in the workout email? I realize Apple Health may not allow it as part of the workout for indoor exercises, but having in the summary email would be nice.

@cagnulein
Copy link
Owner Author

and thinking that launching the watch app by itself was also opening the app on the phone

yes it should auto run it. Infact it's the same flow as I did every time

Also - I'm going to open another feature request - but I think should be easy -- is it possible to include elevation gain in the workout email? I realize Apple Health may not allow it as part of the workout for indoor exercises, but having in the summary email would be nice.

absolutely I thought that it was already in!

@ndevries84
Copy link

This is awesome, worked first try! Turned iPad on first, then turned on apple watch app, it asked for permissions, and then instantly connected. Way quicker then any other HR monitor I have used in terms of connecting and supplying the initial HR

@RickNY
Copy link

RickNY commented Oct 4, 2022

OK.. Did my walk this evening on the iPad.. Everything worked great with Apple Watch HR!

ipad_hr

@cagnulein
Copy link
Owner Author

yeah! thank you guys for the feedbacks! i'm closing this one but if you have issue let me know

@RickNY so the reset help somehow?

@cagnulein
Copy link
Owner Author

seems that ios 16.3.1 broke something about this

@cagnulein
Copy link
Owner Author

just checked and it worked on my side. BUT i saw something that could explain your issue and also how to fix it as a workaround. Follow these steps:

  1. be sure that your iphone and ipad are on the same wifi network
  2. turn on the QZ app on the watch and press start, your HR will appear on the QZ app on the watch
  3. turn on QZ on the ipad and be sure your heart rate belt name is set to "Disabled" (should already be)
  4. if your HR doesn't appear on the ipad or it just freezes, press stop on the watch app; on the iphone, open the qz app, and full close it (with the swipe gesture). Then put the iphone sleep (i mean you don't need to use it anymore, it has just to stay connected to the wifi) and press start again on the QZ app on the watch. In this way it works every time on my side
    Also, in order to debug it, you can install the discovery app, and you should see something like this.
    Screenshot 2023-04-01 at 17 48 34
    If the qz_iphone is empty, you have to repeat the point 4. Let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants