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

[BUG] Peloton Auto-sync not working after Peloton app update #1767

Closed
marklogan17 opened this issue Nov 3, 2023 · 38 comments
Closed

[BUG] Peloton Auto-sync not working after Peloton app update #1767

marklogan17 opened this issue Nov 3, 2023 · 38 comments
Assignees
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@marklogan17
Copy link

Android tablet (Samsung Galaxy S9). Peloton running. QZ running with floating window and peloton auto-sync enabled. Worked correctly until recent Peloton app update (where they introduced the tracking for cadence and resistance in the app). Since that update QZ seems to have started as soon as you hit 'Yes' on the prompt. I end up needing to use the Peloton offset to get somewhere close to -60s to get the class in sync.

Log file attached

@marklogan17 marklogan17 added the bug Something isn't working label Nov 3, 2023
@marklogan17
Copy link
Author

@cagnulein
Copy link
Owner

mmm ok let's start saying that peloton didn't change the API. They're starting with

   "instructor_cues":[
      {
         "cadence_range":{
            "lower":80,
            "upper":100
         },
         "offsets":{
            "end":65,
            **"start":60**
         },
         "resistance_range":{
            "lower":25,
            "upper":40
         }

as usual

@cagnulein
Copy link
Owner

i'm checking if maybe it's the autosync the issue

@cagnulein
Copy link
Owner

@marklogan17 it seems that the auto sync is not working anymore that's the issue. I see over and over the same frame in the OCR, like peloton blocks QZ from getting their frame (video protection).

If you press yes on the popup when the timer is 0:00 after the intro i guess it should be fine right?

@marklogan17
Copy link
Author

@marklogan17 it seems that the auto sync is not working anymore that's the issue. I see over and over the same frame in the OCR, like peloton blocks QZ from getting their frame (video protection).

If you press yes on the popup when the timer is 0:00 after the intro i guess it should be fine right?

Yup, I think that would work just like it does when auto-sync is off. I wonder if I can bypass the video protection...

@cagnulein
Copy link
Owner

it's the same issue on google tv #1441
i guess they added on all the platform now, so I guess it's end of the game for auto sync with OCR. Maybe I have to investigate other ways like trying to get the elapsed time from the API (way better in case)

@marklogan17
Copy link
Author

Oh well, I can hit start at the right time :)

@cagnulein
Copy link
Owner

cagnulein commented Nov 3, 2023 via email

@cagnulein
Copy link
Owner

@marklogan17 I had an idea: when you have time could you please provide me a qz debug log where

  1. Start a peloton workout
  2. Do it , for example , 5 minutes and then pause it from peloton app
  3. Wait 2 minutes and resume it

If I can get this event I can do auto sync without the ocr

@marklogan17
Copy link
Author

Turned off auto sync.

  • Started QZ (with floating window), started Peloton, picked class, started class.
  • Waited until intro was done and hit 'yes' on floating window.
  • Road for 5 minutes
  • Hit pause on peloton
  • Waited a bit over 2 minutes (kept riding)
  • Hit 'play' on peloton
  • Rode for approx 2 minutes
  • BONUS:
  • Hit 'forward 30 seconds' on Peloton
  • Rode for 30 seconds or so
  • Hit 'back 30 seconds' on Peloton
  • Rode for 30 seconds or so
  • Ended class
  • Exited QZ

Log file attached
debug-Fri_Nov_3_16_43_57_2023.zip

@cagnulein
Copy link
Owner

cagnulein commented Nov 4, 2023 via email

@cagnulein
Copy link
Owner

thanks @marklogan17 for the test, unfortunately there is no difference along the whole workout until you finished it :(

So, if you want and you're available we can try to collect some information from the developer view on chrome or any other browser. I would like to do myself but as you know I can't access to a peloton account from Italy and for other reasons...

So the test would be (it has sense only if you can see the elapsed timer on the web interface of peloton):

  1. open qz as usual
  2. start peloton from your web browser
  3. open the developer view (F12 usually)
  4. do the same workout with the same pause that you did last time
  5. share the chrome report
Screenshot 2023-11-04 at 11 49 25

you can export also the HAR file in chrome with all the details I guess.
I would like to check if peloton app uses also other API endpoint to collect other information

Thanks as usual!

@marklogan17
Copy link
Author

Did the same class in the browser.
-Ran for 5 minutes, pause

  • Waited for 2 minutes, play
  • Waited for two minutes, scrolled 'back' in time 30 seconds or so (could have been more)
  • Waited for a while - say a minute, scrolled forward in time so that I was well past where I was originally
  • waited for a minute, paused, ended workout

HAR file: https://drive.google.com/file/d/1nLxt41JNYQvPqPVrN0hkS--YFsb_67cA/view?usp=drive_link

@cagnulein
Copy link
Owner

@marklogan17 great news!

In the "packets" (https://api.onepeloton.com/stats/workout/a811af1630c148e5bc470fe8d68f51e6/packets) endpoint i can see the real seconds (i can see you jumping back and forth!).

The only issue is that it seems a writing endpoint so we have to understand if we can also read them. Bonus issue: it seems that the web app is writing it only every 10 seconds)

So that's my plan: I will build a new PC version of qz trying to read that endpoint. I hope will have some results from it

I will share here the link for the PC version.

When you will have it, you can just enable the fake bike setting, adding your peloton credentials and do a fake workout of 1-2 minutes with the debug log enabled

Thanks in advance!

@cagnulein
Copy link
Owner

also @marklogan17 I guess we can check the API with the same chrome procedure from this website https://support.onepeloton.com/hc/en-us/articles/13924166574356-Downloading-Your-Workout-History-and-Data (trying to get a workout)

@cagnulein
Copy link
Owner

@marklogan17
Copy link
Author

@marklogan17 windows build https://github.com/cagnulein/qdomyos-zwift/suites/17933945182/artifacts/1030659122

Trouble connecting to Peloton. Debug log. I'm sure the username and password was right - tried username, email, etc. Could have been airport wifi. Could have been vpn or firewall on the laptop we were using. Will find another system to try it on later.

https://drive.google.com/file/d/1sAP93160sRZnElQLKzUhRNTcCM5N5PbG/view?usp=drive_link

@cagnulein
Copy link
Owner

that's the error

QSslSocket::connectToHostEncrypted: TLS initialization failed

it could be something on the windows build. I'm checking it

@cagnulein
Copy link
Owner

@marklogan17 peloton auth fixed https://github.com/cagnulein/qdomyos-zwift/suites/18009692409/artifacts/1036335623

Let me know! Sorry for the delay, crazy days as usual!

@marklogan17
Copy link
Author

I'll see if we can get it tested today!

@marklogan17
Copy link
Author

Ran it. Success connecting to Peloton (green checkmark). Ran it, ran class on separate device. Didn't get prompt on QZ to follow class. Tried it with auto sync enabled the second time because, well, why not :)

https://docs.google.com/document/d/1niF9SHAsoTgG8B-2sifWRnshJrXZaE19iDAyDRx3kFI/edit?usp=drive_link
https://docs.google.com/document/d/1KOeHeI17w8uRg2Mw_C_f-j32W133EDksB_3N1MCSB54/edit?usp=drive_link

@cagnulein
Copy link
Owner

ok that's the issue

Thu Nov 9 05:59:33 2023 1699538373690 Debug: .\peloton.cpp void __cdecl peloton::getPackets(void) peloton::getPackets QUrl("https://api.onepeloton.com/stats/workout/a811af1630c148e5bc470fe8d68f51e6/packets")
Thu Nov 9 05:59:33 2023 1699538373841 Debug: .\peloton.cpp void __cdecl peloton::packets_onfinish(class QNetworkReply *) ""

the API that I added that I hoped it was read/write it seems to be read only.
I will investigate if I will find an API in the "stats/workout" are that could contain all the information that we need.
I will keep you updated
Thanks for the test!

@cagnulein
Copy link
Owner

also @marklogan17 I guess we can check the API with the same chrome procedure from this website https://support.onepeloton.com/hc/en-us/articles/13924166574356-Downloading-Your-Workout-History-and-Data (trying to get a workout)

when you have time could you please also check this?

@marklogan17
Copy link
Author

@cagnulein
Copy link
Owner

cagnulein commented Nov 10, 2023 via email

@marklogan17
Copy link
Author

marklogan17 commented Nov 10, 2023

thanks, i will check it asap. i hope it's time to flying back home ;) Il giorno ven 10 nov 2023 alle 21:36 marklogan17 @.***> ha scritto:

Got home last night! Home for two whole weeks now!!

@cagnulein
Copy link
Owner

log checked, unfortunately there is only the https://api.onepeloton.com/api/user/xxxxx/workouts?joins=ride&limit=10&page=0 api used...

Is there any other webpage on the peloton website that you think that could contains useful data?

Otherwise my last idea for this (and I know for sure that will work) is to embeed the website of peloton inside QZ and so i can inject a javascript to collect the elapsed time without using the OCR.

What do you think?

@marklogan17
Copy link
Author

log checked, unfortunately there is only the https://api.onepeloton.com/api/user/xxxxx/workouts?joins=ride&limit=10&page=0 api used...

Is there any other webpage on the peloton website that you think that could contains useful data?

Otherwise my last idea for this (and I know for sure that will work) is to embeed the website of peloton inside QZ and so i can inject a javascript to collect the elapsed time without using the OCR.

What do you think?

Nothing I can think of. Obviously there has to be some control from the web to the servers and the app to the servers to keep everything in sync. Potentially could do wireshark to sniff the app to see if its doing anything different but you would think they would have the same mechanism for web and app versions.

@cagnulein
Copy link
Owner

Potentially could do wireshark to sniff the app to see if its doing anything different but you would think they would have the same mechanism for web and app versions.

Yes I guess they have the same behaviour...what do you think about the embedded version of peloton in the qz app?

@cagnulein
Copy link
Owner

image

@cagnulein
Copy link
Owner

@marklogan17 ok almost done (at least for html parsing)

How to Use:

  1. unzip the bookmarklet.zip
  2. Right-click on your bookmarks bar in your web browser and choose to add a new bookmark.
  3. Name it as you like, for example, "Find Time to Complete".
  4. In the URL or location field, paste the entire code provided in the js file.
  5. Save the bookmark.
  6. When you are on a peloton workout with the elasped timer, just click on it. If an element with data-test-id="time-to-complete" is found, it will display its text content in an alert box; otherwise, it will alert you that the element is not found.

bookmarlet.zip

Let me know, I will be ready tomorrow or in the day after tomorrow with a test version in qz ;)

@cagnulein
Copy link
Owner

ok that's my idea to try to understand this: I will create a simple android app directly in java to understand if the standard webview has also this limitation. I will let you know the result!

@cagnulein
Copy link
Owner

ok tried, it works fine. so there is something to setup in the android webview under the qt or I will try to use a standard component directly on QZ. I will keep you posted

@cagnulein
Copy link
Owner

ok, update. The error is about stryde unrecognized feature payment stryde
This will not trigger peloton to show the login bar unfortunately.

So I already thought about a second solution: using a bookmarklet that can send data via udp like the QZ AI companion app already did! It should also be easier. I will let you know!

@cagnulein
Copy link
Owner

ok due to security browser reason i need to add a https server in the middle that receives the info from the browser and it sends to qz

i don't know how many out there will run peloton on browser for auto sync.

@marklogan17
Copy link
Author

ok due to security browser reason i need to add a https server in the middle that receives the info from the browser and it sends to qz

i don't know how many out there will run peloton on browser for auto sync.

Its a lot of work when the alternative is just hitting 'yes' at the right time and everything works fine...

@cagnulein
Copy link
Owner

lol yes, anyway this it will also bring the floating window on ios for example. It will be nice in the future. I will keep you updated if something new will pop up in my mind.

Copy link

stale bot commented Dec 9, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Dec 9, 2023
@stale stale bot closed this as completed Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants