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] QZ running on rpi is not detected by Peleton app running on Android phone #1913

Closed
alwant opened this issue Dec 26, 2023 · 43 comments · May be fixed by #1915
Closed

[BUG] QZ running on rpi is not detected by Peleton app running on Android phone #1913

alwant opened this issue Dec 26, 2023 · 43 comments · May be fixed by #1915
Assignees
Labels
bug Something isn't working wontfix This will not be worked on
Milestone

Comments

@alwant
Copy link

alwant commented Dec 26, 2023

Describe the bug
I have two instances of QZ running separately on an android phone, and on a raspberry pi. Both read metrics from a Nordictrak 1750 commercial treadmill running the Nordictrack companion app.

Only QZ running on the android phone is detected by the Peloton app on a different phone.

Here's a few screenshots of "nRF Connect" for the two devices

Here's how the rpi shows up
rpi - profile
rpi details

And this is the pixel phone
Pixel 8 pro - profile
Pixel 8 Pro details

And this is what is detected by the Peloton app
Peloton app - connection page

@alwant alwant added the bug Something isn't working label Dec 26, 2023
@alwant
Copy link
Author

alwant commented Dec 26, 2023

By the way under "treadmill data" I can see correct and changing values of incline and speed, so the rpi is streaming the right metrics over bluetooth. It's just not picked up by the Peloton app.

@cagnulein
Copy link
Owner

maybe it's only a name issue on the peloton app? or maybe it's not about metrics, it's about the device name characteristics

@cagnulein
Copy link
Owner

i mean the 1800 and 1801 characteristics. raspberry doesn't have and phone does, right? i guess that's the issue

@alwant
Copy link
Author

alwant commented Dec 26, 2023

oh, interesting. From a cursory search, it appears that generic services 0x1800 and 1801 are mandatory for BT compliance: https://devzone.nordicsemi.com/guides/short-range-guides/b/bluetooth-low-energy/posts/ble-services-a-beginners-tutorial

@cagnulein
Copy link
Owner

yeah but not for zwift or any other apps :) anyway it's very easy to add them, i will create a branch for you in the next days

@alwant
Copy link
Author

alwant commented Dec 26, 2023

I don't know if it's helpful, but I have a Garmin EPIX 2, and it's supposed to emit FTMS when using the "Virtual race" activity broadcasting HR and speed and cadence (if you have a HRM strap or a running dynamics pod, which I do). Somehow the Peloton app also doesn't detect it.

Now that I know where to look, I explored the BT profile and I can see it's broadcasting the 1800 and 1801 generic services along with other stuff. This makes me think that there's something else going on with the Peloton app (could they be filtering based on the name to limit "competitors" like Garmin from connecting with their stuff?).

I'm posting a screenshot here of the watch profile in case it's useful and you spot something interesting. And TYSM for looking into this!

EPIX 2 Garmin watch profile for Virtual Run

image
image

Pixel 8 Pro generic profiles values (for reference)

image

@cagnulein
Copy link
Owner

cagnulein commented Dec 26, 2023 via email

@alwant
Copy link
Author

alwant commented Dec 26, 2023

I have a windows box (and linux on ChromeOS)

@cagnulein
Copy link
Owner

cagnulein commented Dec 26, 2023 via email

@alwant
Copy link
Author

alwant commented Dec 26, 2023

you're on to something here... the windows version shows up right away without any issues. It's something to do with the rpi

@cagnulein
Copy link
Owner

cagnulein commented Dec 26, 2023 via email

@cagnulein
Copy link
Owner

@alwant I created a new PR for you #1915
Pull it, build it and give it a try. I didn't test it myself because I don't have access to a raspberry ATM

@cagnulein cagnulein linked a pull request Dec 27, 2023 that will close this issue
@alwant
Copy link
Author

alwant commented Dec 27, 2023

I'll be honest. I don't know how gitgub works. So I asked chatgpt and it told me to run "git fetch origin" after which I discovered there's a branch called peloton_raspberry_treadmill. I then did git checkout peloton_raspberry_treadmill and git pull origin peloton_raspberry_treadmill

Let me know if I'm completely off track

@cagnulein
Copy link
Owner

cagnulein commented Dec 27, 2023 via email

@alwant
Copy link
Author

alwant commented Dec 27, 2023

I wasn't able to get a new binary. This is what I got (after a long time recompiling)

g++ -Wl,-O1 -s -pipe -fno-sized-deallocation -O3 -std=gnu++1z -flto=4 -fno-fat-lto-objects -fuse-linker-plugin -Wl,-rpath-link,/usr/lib/aarch64-linux-gnu -fPIC -o qdomyos-zwift androidactivityresultreceiver.o androidadblog.o apexbike.o pelotonbike.o wahookickrheadwind.o ziprotreadmill.o Computrainer.o PathController.o characteristicnotifier2a53.o characteristicnotifier2a5b.o characteristicnotifier2acc.o characteristicnotifier2acd.o characteristicnotifier2ad9.o characteristicwriteprocessor.o characteristicwriteprocessore005.o computrainerbike.o fakeelliptical.o faketreadmill.o lifefitnesstreadmill.o mepanelbike.o nautilusbike.o nordictrackelliptical.o nordictrackifitadbbike.o nordictrackifitadbtreadmill.o octaneelliptical.o octanetreadmill.o proformellipticaltrainer.o proformrower.o proformwifibike.o proformwifitreadmill.o abstractserver.o bitmap.o browser.o cache.o dns.o hostname.o mdns.o message.o prober.o provider.o query.o record.o resolver.o server.o service.o activiotreadmill.o bhfitnesselliptical.o bike.o bluetooth.o bluetoothdevice.o characteristicnotifier2a37.o characteristicnotifier2a63.o characteristicnotifier2ad2.o characteristicwriteprocessor2ad9.o bowflext216treadmill.o bowflextreadmill.o chronobike.o concept2skierg.o cscbike.o dirconmanager.o dirconpacket.o dirconprocessor.o domyoselliptical.o domyosrower.o domyostreadmill.o echelonconnectsport.o echelonrower.o echelonstride.o eliterizer.o elitesterzosmart.o elliptical.o eslinkertreadmill.o fakebike.o filedownloader.o fitmetria_fanfit.o fitplusbike.o fitshowtreadmill.o fit.o fit_accumulated_field.o fit_accumulator.o fit_buffer_encode.o fit_buffered_mesg_broadcaster.o fit_buffered_record_mesg_broadcaster.o fit_crc.o fit_date_time.o fit_decode.o fit_developer_field.o fit_developer_field_definition.o fit_developer_field_description.o fit_encode.o fit_factory.o fit_field.o fit_field_base.o fit_field_definition.o fit_mesg.o fit_mesg_broadcaster.o fit_mesg_definition.o fit_mesg_with_event_broadcaster.o fit_profile.o fit_protocol_validator.o fit_unicode.o flywheelbike.o ftmsbike.o ftmsrower.o gpx.o heartratebelt.o homefitnessbuddy.o homeform.o horizongr7bike.o horizontreadmill.o iconceptbike.o inspirebike.o keepawakehelper.o keepbike.o kingsmithr1protreadmill.o kingsmithr2treadmill.o main.o mcfbike.o metric.o nautiluselliptical.o nautilustreadmill.o npecablebike.o pafersbike.o paferstreadmill.o peloton.o powerzonepack.o proformbike.o proformelliptical.o proformtreadmill.o qfit.o qzsettings.o renphobike.o rower.o schwinnic4bike.o screencapture.o sessionline.o shuaa5treadmill.o signalhandler.o simplecrypt.o skandikawiribike.o smartrowrower.o smartspin2k.o emailaddress.o mimeattachment.o mimecontentformatter.o mimefile.o mimehtml.o mimeinlinefile.o mimemessage.o mimemultipart.o mimepart.o mimetext.o quotedprintable.o smtpclient.o snodebike.o solebike.o soleelliptical.o solef80treadmill.o spirittreadmill.o sportsplusbike.o sportstechbike.o strydrunpowersensor.o tacxneo2.o tcpclientinfosender.o technogymmyruntreadmill.o technogymmyruntreadmillrfcomm.o templateinfosender.o templateinfosenderbuilder.o stagesbike.o toorxtreadmill.o treadmill.o truetreadmill.o trxappgateusbbike.o ultrasportbike.o virtualrower.o wahookickrsnapbike.o yesoulbike.o trainprogram.o trxappgateusbtreadmill.o virtualbike.o virtualtreadmill.o m3ibike.o domyosbike.o scanrecordresult.o zwiftworkout.o mainwindow.o charts.o inappproductqmltype.o inappstoreqmltype.o inappproduct.o inapppurchasebackend.o inappstore.o inapptransaction.o qdomyos-zwift_qmltyperegistrations.o qrc_icons.o qrc_qml.o moc_androidadblog.o moc_apexbike.o moc_pelotonbike.o moc_wahookickrheadwind.o moc_ziprotreadmill.o moc_characteristicwriteprocessore005.o moc_computrainerbike.o moc_fakeelliptical.o moc_faketreadmill.o moc_lifefitnesstreadmill.o moc_mepanelbike.o moc_nautilusbike.o moc_nordictrackelliptical.o moc_nordictrackifitadbbike.o moc_nordictrackifitadbtreadmill.o moc_octaneelliptical.o moc_octanetreadmill.o moc_proformellipticaltrainer.o moc_proformrower.o moc_proformwifibike.o moc_proformwifitreadmill.o moc_abstractserver.o moc_browser.o moc_cache.o moc_hostname.o moc_prober.o moc_provider.o moc_resolver.o moc_server.o moc_browser_p.o moc_cache_p.o moc_hostname_p.o moc_prober_p.o moc_provider_p.o moc_resolver_p.o moc_server_p.o moc_activiotreadmill.o moc_bhfitnesselliptical.o moc_bike.o moc_bluetooth.o moc_bluetoothdevice.o moc_characteristicnotifier.o moc_characteristicwriteprocessor.o moc_characteristicwriteprocessor2ad9.o moc_bowflext216treadmill.o moc_bowflextreadmill.o moc_chronobike.o moc_concept2skierg.o moc_cscbike.o moc_dirconmanager.o moc_dirconprocessor.o moc_domyoselliptical.o moc_domyosrower.o moc_domyostreadmill.o moc_echelonconnectsport.o moc_echelonrower.o moc_echelonstride.o moc_eliterizer.o moc_elitesterzosmart.o moc_elliptical.o moc_eslinkertreadmill.o moc_fakebike.o moc_filedownloader.o moc_fitmetria_fanfit.o moc_fitplusbike.o moc_ftmsrower.o moc_homefitnessbuddy.o moc_horizongr7bike.o moc_iconceptbike.o moc_keepbike.o moc_kingsmithr1protreadmill.o moc_kingsmithr2treadmill.o moc_m3ibike.o moc_fitshowtreadmill.o moc_flywheelbike.o moc_ftmsbike.o moc_heartratebelt.o moc_homeform.o moc_horizontreadmill.o moc_inspirebike.o moc_material.o moc_mcfbike.o moc_nautiluselliptical.o moc_nautilustreadmill.o moc_npecablebike.o moc_pafersbike.o moc_paferstreadmill.o moc_peloton.o moc_powerzonepack.o moc_proformbike.o moc_proformelliptical.o moc_proformtreadmill.o moc_qfit.o moc_renphobike.o moc_rower.o moc_schwinnic4bike.o moc_screencapture.o moc_shuaa5treadmill.o moc_skandikawiribike.o moc_smartrowrower.o moc_smartspin2k.o moc_emailaddress.o moc_mimeattachment.o moc_mimecontentformatter.o moc_mimefile.o moc_mimehtml.o moc_mimemultipart.o moc_mimepart.o moc_quotedprintable.o moc_smtpclient.o moc_snodebike.o moc_solebike.o moc_soleelliptical.o moc_solef80treadmill.o moc_spirittreadmill.o moc_sportsplusbike.o moc_sportstechbike.o moc_strydrunpowersensor.o moc_tacxneo2.o moc_tcpclientinfosender.o moc_technogymmyruntreadmill.o moc_technogymmyruntreadmillrfcomm.o moc_templateinfosender.o moc_templateinfosenderbuilder.o moc_stagesbike.o moc_toorxtreadmill.o moc_gpx.o moc_treadmill.o moc_mainwindow.o moc_trainprogram.o moc_truetreadmill.o moc_trxappgateusbbike.o moc_trxappgateusbtreadmill.o moc_ultrasportbike.o moc_virtualbike.o moc_virtualrower.o moc_virtualtreadmill.o moc_domyosbike.o moc_wahookickrsnapbike.o moc_wobjectdefs.o moc_yesoulbike.o moc_charts.o moc_inappproductqmltype.o moc_inappstoreqmltype.o moc_inappproduct.o moc_inapppurchasebackend.o moc_inappstore.o moc_inapptransaction.o   /usr/lib/aarch64-linux-gnu/libQt5Charts.so /usr/lib/aarch64-linux-gnu/libQt5Widgets.so /usr/lib/aarch64-linux-gnu/libQt5Location.so /usr/lib/aarch64-linux-gnu/libQt5PositioningQuick.so /usr/lib/aarch64-linux-gnu/libQt5QuickControls2.so /usr/lib/aarch64-linux-gnu/libQt5Quick.so /usr/lib/aarch64-linux-gnu/libQt5Multimedia.so /usr/lib/aarch64-linux-gnu/libQt5Gui.so /usr/lib/aarch64-linux-gnu/libQt5Bluetooth.so /usr/lib/aarch64-linux-gnu/libQt5Xml.so /usr/lib/aarch64-linux-gnu/libQt5Positioning.so /usr/lib/aarch64-linux-gnu/libQt5QmlModels.so /usr/lib/aarch64-linux-gnu/libQt5Qml.so /usr/lib/aarch64-linux-gnu/libQt5NetworkAuth.so /usr/lib/aarch64-linux-gnu/libQt5WebSockets.so /usr/lib/aarch64-linux-gnu/libQt5Network.so /usr/lib/aarch64-linux-gnu/libQt5TextToSpeech.so /usr/lib/aarch64-linux-gnu/libQt5Core.so -lGL -lpthread   
/usr/bin/ld: /tmp/cc72ryYV.ltrans9.ltrans.o: in function `QMdnsEngine::ProviderPrivate::onMessageReceived(QMdnsEngine::Message const&)':
<artificial>:(.text+0x762c): undefined reference to `localipaddress::getIP(QHostAddress const&)'
collect2: error: ld returned 1 exit status
make: *** [Makefile:1508: qdomyos-zwift] Error 1

@cagnulein
Copy link
Owner

cagnulein commented Dec 27, 2023 via email

@alwant
Copy link
Author

alwant commented Dec 27, 2023

make clean made ended things a little earlier

g++ -c -pipe -fno-sized-deallocation -O3 -std=gnu++1z -flto -fno-fat-lto-objects -Wall -Wextra -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DIO_UNDER_QT -DSMTP_BUILD -DQT_NO_DEBUG -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_LOCATION_LIB -DQT_POSITIONINGQUICK_LIB -DQT_QUICKCONTROLS2_LIB -DQT_QUICK_LIB -DQT_MULTIMEDIA_LIB -DQT_GUI_LIB -DQT_BLUETOOTH_LIB -DQT_XML_LIB -DQT_POSITIONING_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_NETWORKAUTH_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_TEXTTOSPEECH_LIB -DQT_CORE_LIB -I. -Iqmdnsengine/src/include -Iqmdnsengine/src/include -Ifit-sdk -Ipurchasing/qmltypes -Ipurchasing/inapp -I/usr/include/aarch64-linux-gnu/qt5 -I/usr/include/aarch64-linux-gnu/qt5/QtCharts -I/usr/include/aarch64-linux-gnu/qt5/QtWidgets -I/usr/include/aarch64-linux-gnu/qt5/QtLocation -I/usr/include/aarch64-linux-gnu/qt5/QtPositioningQuick -I/usr/include/aarch64-linux-gnu/qt5/QtQuickControls2 -I/usr/include/aarch64-linux-gnu/qt5/QtQuick -I/usr/include/aarch64-linux-gnu/qt5/QtMultimedia -I/usr/include/aarch64-linux-gnu/qt5/QtGui -I/usr/include/aarch64-linux-gnu/qt5/QtBluetooth -I/usr/include/aarch64-linux-gnu/qt5/QtXml -I/usr/include/aarch64-linux-gnu/qt5/QtPositioning -I/usr/include/aarch64-linux-gnu/qt5/QtQmlModels -I/usr/include/aarch64-linux-gnu/qt5/QtQml -I/usr/include/aarch64-linux-gnu/qt5/QtNetworkAuth -I/usr/include/aarch64-linux-gnu/qt5/QtWebSockets -I/usr/include/aarch64-linux-gnu/qt5/QtNetwork -I/usr/include/aarch64-linux-gnu/qt5/QtTextToSpeech -I/usr/include/aarch64-linux-gnu/qt5/QtCore -I. -I. -I/usr/lib/aarch64-linux-gnu/qt5/mkspecs/linux-g++ -o provider.o qmdnsengine/src/src/provider.cpp
qmdnsengine/src/src/provider.cpp:36:10: fatal error: localipaddress.h: No such file or directory
   36 | #include "localipaddress.h"
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:12990: provider.o] Error 1

@cagnulein
Copy link
Owner

cagnulein commented Dec 28, 2023 via email

@alwant
Copy link
Author

alwant commented Dec 29, 2023

And, we're in business! 😄

Works perfectly. I'll try to squeeze a workout later on today, but it shows up as an FTMS treadmill on the Peloton app, and I was able to connect to it just fine!

QQ - is there a way to rename the beacon to something else, like "qz-rpi" ?

@cagnulein
Copy link
Owner

amazing! for the name, yes but i love that name because it was one of the first line of the project :)

@cagnulein
Copy link
Owner

let me know if i can merge the code if it's working good!

@alwant
Copy link
Author

alwant commented Dec 29, 2023

I learned something else: because the daemon runs as a service as root, some of the files in my home directory had changed ownership/permission. Recompiling the source code kept failing because of that reason (but the error message was non-descriptive), as my username couldn't overwrite files.

I had to delete the directory altogether, and it worked when I started from scratch.

@alwant
Copy link
Author

alwant commented Dec 29, 2023

let me know if i can merge the code if it's working good!

Will try tonight and let you know!

@cagnulein
Copy link
Owner

QQ - is there a way to rename the beacon to something else, like "qz-rpi" ?

hah you mean the pixel 6? yes for sure! I was thinking about the DomyosBR :)

@alwant
Copy link
Author

alwant commented Jan 2, 2024

Confirmed, I was able to do an entire workout on the rpi beacon, and this time it also recorded the distance! Amazing, the issue is now resolved, you can merge this back into the main branch

@cagnulein
Copy link
Owner

perfect! i will try to do this tomorrow!

@cagnulein
Copy link
Owner

@alwant could you please pull it and build it again? I cleaned the code and i renamed the qz device.
Let me know!

@alwant
Copy link
Author

alwant commented Jan 6, 2024

I am not able to see it now. I see two devices with name "N/A" on nRF Connect, I wonder if it's one of those. But the peloton app can't see it now

@cagnulein
Copy link
Owner

cagnulein commented Jan 6, 2024 via email

@alwant
Copy link
Author

alwant commented Jan 6, 2024

from nRF connect? Or where else?

@cagnulein
Copy link
Owner

enable the debug log from qz on the raspberry and upload the debug log created on the same folder

@alwant
Copy link
Author

alwant commented Jan 6, 2024

gotcha. I captured standard output and error here via
sudo /home/alberto/qdomyos-zwift/src/qdomyos-zwift -no-gui -heart-service >& debug.log

debug.log

@alwant
Copy link
Author

alwant commented Jan 6, 2024

But only now I noticed that a debug file is created individually at every run 😄

Here's the other one, they're probably the same

debug-Sat_Jan_6_12_48_34_2024.log

@cagnulein
Copy link
Owner

mmm i don't see anything strange in the debug log, did you still have the previous binary? is it still working? i can try to revert just the name modification to check that's the issue

@alwant
Copy link
Author

alwant commented Jan 6, 2024 via email

@cagnulein
Copy link
Owner

cagnulein commented Jan 6, 2024 via email

@alwant
Copy link
Author

alwant commented Jan 6, 2024

I reverted back to 4ba070e and things work as expected (see screenshot). Not sure why.

Screenshot_20240106-175753

@cagnulein
Copy link
Owner

cagnulein commented Jan 7, 2024 via email

@cagnulein
Copy link
Owner

I reverted the name modification and added a new debug log. Could you try to pull it again? You can save the binary of the working build in order to swap it quickly for the tests. Thanks!

@alwant
Copy link
Author

alwant commented Jan 8, 2024

Ok, this is weird. I tried running the newly compiled binary. Turned on the treadmill (in this sequence), then opened the peloton app. The peloton app could see the Bluetooth treadmill via QZ. However, I couldn't see any treadmill data in the app.

I thought that it was probably because I started the treadmill after the deamon.

So I killed the deamon, and the peloton app dropped the treadmill as the BT beacon wasn't there anymore

I restarted qz but at that point it wasn't visible by the Peloton app anymore despite repeated attempts.

Here are the two debug sessions for the attempt described above

debug-Mon_Jan_8_17_54_46_2024.log
debug-Mon_Jan_8_17_49_28_2024.log

@cagnulein
Copy link
Owner

i can't see any difference in the code, that's crazy! did you check with nrfconnect with the new build if you can see the same? can you a new build vs old build with nrfconnect to compare them? i just renamed the variables in a cleaner way, that's it!

Copy link

stale bot commented Jan 25, 2024

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 Jan 25, 2024
@stale stale bot closed this as completed Feb 1, 2024
@cagnulein
Copy link
Owner

@alwant Any news?

@cagnulein cagnulein reopened this Feb 1, 2024
@stale stale bot closed this as completed Feb 8, 2024
@cagnulein cagnulein added this to the 2.16 milestone Feb 8, 2024
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