cagnulein / qdomyos-zwift

Zwift bridge for smart treadmills and bike/cyclette
https://www.qzfitness.com/
GNU General Public License v3.0
431 stars 117 forks source link

ZWIFT API #1921

Closed cagnulein closed 10 months ago

cagnulein commented 11 months ago

@victorypoint , @Ghilm1986 did a HUGE discovery! Check this https://github.com/snicker/zwift_hass/blob/master/custom_components/zwift/sensor.py @ghilm1986 is using with home assistant and it's giving realtime data!! image

I'm implementing it!

cagnulein commented 11 months ago

of course @victorypoint I already started, I should have some code to test today (if ChatGPT code is ok :D )

victorypoint commented 11 months ago

@cagnulein, this looks really interesting. What information are you obtaining?

cagnulein commented 11 months ago

theorically everything you see on the companion :) I'm finalizing right now, i hope to have something for today/tomorrow

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno gio 28 dic 2023 alle ore 16:37 Al Udell @.***> ha scritto:

@cagnulein https://github.com/cagnulein, this looks really interesting. What information are you obtaining?

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/1921#issuecomment-1871282096, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWF2YZ2BX4X7YD7BUGLYLWG3RAVCNFSM6AAAAABBFL2RMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZRGI4DEMBZGY . You are receiving this because you were mentioned.Message ID: @.***>

cagnulein commented 11 months ago
Screenshot 2023-12-28 at 18 10 34

unbeliavable all the stats are in clear! for all the users!

cagnulein commented 11 months ago

i can also log the X e Y coordinate in the fit file @victorypoint !!!!!

victorypoint commented 11 months ago

@cagnulein this is wonderful news! Are you able to obtain zwift elevation from the topography like bikes do and use it instead of incline for runners?

cagnulein commented 11 months ago

yes using the delta from the odometer and elevation...Now i need to pause it, baby is calling :)

victorypoint commented 10 months ago

@cagnulein, test of ios testflight build 2.16 (696). Speed and incline tiles work with NT C2950 TM. +- controls work fine. Note that speed increments in values of 1, incline in values of 0.5. QZ to Zwift works good (dircon). Zwift auto-inclination does not work. Have not tested incline portal or workout yet.

debug-Sat_Dec_30_16_48_56_2023.log

victorypoint commented 10 months ago

@cagnulein, I should confirm which multitasking mode to use? I'm using ipad pro with latest ipados, currently using 'stage manager' mode, not 'view/slide over' mode.

cagnulein commented 10 months ago

no wait you can't use zwift on the same device. qz on ipad and zwift on pc for example

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno sab 30 dic 2023 alle 22:14 Al Udell @.***> ha scritto:

@cagnulein https://github.com/cagnulein, I should confirm which multitasking mode to use? I'm using ipad pro with latest ipados, currently using 'stage manager' mode, not 'view/slide over' mode.

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/1921#issuecomment-1872608476, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWAIPS6HVRL4PNKRACDYMB73LAVCNFSM6AAAAABBFL2RMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZSGYYDQNBXGY . You are receiving this because you were mentioned.Message ID: @.***>

cagnulein commented 10 months ago

i guess it could be the issue

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno sab 30 dic 2023 alle 22:17 cagnulein @.***> ha scritto:

no wait you can't use zwift on the same device. qz on ipad and zwift on pc for example

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno sab 30 dic 2023 alle 22:14 Al Udell @.***> ha scritto:

@cagnulein https://github.com/cagnulein, I should confirm which multitasking mode to use? I'm using ipad pro with latest ipados, currently using 'stage manager' mode, not 'view/slide over' mode.

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/1921#issuecomment-1872608476, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWAIPS6HVRL4PNKRACDYMB73LAVCNFSM6AAAAABBFL2RMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZSGYYDQNBXGY . You are receiving this because you were mentioned.Message ID: @.***>

victorypoint commented 10 months ago

Oh, okay my mistake. Will retest with Zwift on PC

cagnulein commented 10 months ago

thanks my fault, i didn't mentioned :)

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno sab 30 dic 2023 alle 22:19 Al Udell @.***> ha scritto:

Oh, okay my mistake. Will retest with Zwift on PC

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/1921#issuecomment-1872609136, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWCWVJW7ZA2SFTHFO5DYMCANLAVCNFSM6AAAAABBFL2RMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZSGYYDSMJTGY . You are receiving this because you were mentioned.Message ID: @.***>

victorypoint commented 10 months ago

@cagnulein, ok retested with zwift on pc. Got auto-inclination this time but seemed to be sent very much delayed or maybe the swipe cache was getting overloaded?

[Uploading debug-Sat_Dec_30_17_21_24_2023.log…]()

cagnulein commented 10 months ago

it could be. just check the target incline tile to see the reaction from the zwift api. if they are real time it means that the cache is the issue. in my test it has only 5 secs delay (to don't over call the api). is this the delay?

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno sab 30 dic 2023 alle 22:31 Al Udell @.***> ha scritto:

@cagnulein https://github.com/cagnulein, ok retested with zwift on pc. Got auto-inclination this time but seemed to be sent very much delayed or maybe the swipe cache was getting overloaded?

Uploading debug-Sat_Dec_30_17_21_24_2023.log…

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/1921#issuecomment-1872610730, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWBM5ZNW7NGECWYBAZ3YMCBZ7AVCNFSM6AAAAABBFL2RMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZSGYYTANZTGA . You are receiving this because you were mentioned.Message ID: @.***>

victorypoint commented 10 months ago

@cagnulein, will check after dinner

victorypoint commented 10 months ago

@cagnulein, okay this is looking very promising! I did more auto-incline testing. A few things I noticed:

debug-Sat_Dec_30_18_08_04_2023.log

cagnulein commented 10 months ago

@cagnulein, okay this is looking very promising! I did more auto-incline testing. A few things I noticed:

  • I'm getting an incline delay of anywhere from 3-8 seconds. I confirmed this by manually changing incline and timing how long it would take to auto-incline change back.

yes it sounds right, i have a 5 seconds polling so this delay is sounds like reasonable. i will try to put it to 1 but i guess zwift should be worried about this. how often the zwift companion updates their metrics?

  • Zwift onscreen incline value was not always the incline that was auto-sent (usually 1% off) but most times they agreed.

yes because zwift shows the average of the next 100m but it sends the actual value

  • Auto-incline only applies to logged-in person no matter who you look at (OCR auto-incline worked for whoever you looked at) - this confused me at first 🤣

ahahah yep :P

thanks for the test!

victorypoint commented 10 months ago

@cagnulein, so the API ties in with Zwift Companion and gets metrics from there?

cagnulein commented 10 months ago

the api that i added are the same that the companion uses. so all the info that the companion has we can also have too now

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno sab 30 dic 2023 alle 23:40 Al Udell @.***> ha scritto:

@cagnulein https://github.com/cagnulein, so the API ties in with Zwift Companion and gets metrics from there?

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/1921#issuecomment-1872619706, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWENFPY7HJMY5MBYC2LYMCJ7BAVCNFSM6AAAAABBFL2RMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZSGYYTSNZQGY . You are receiving this because you were mentioned.Message ID: @.***>

victorypoint commented 10 months ago

@cagnulein, let's reduce the polling interval to something very small and I'll give it a good test. Oh, and Happy New Year!!! 🥳🎉

cagnulein commented 10 months ago

@victorypoint happy new year! i saw the companion updates every 5 seconds so i guess it's more or less a load limitation on the zwift server. i don't want to flood them (i don't want to encounter TOS issues).

let's see what the users will say :) maybe i will put a 3 seconds at max

stale[bot] commented 10 months ago

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.