cagnulein / qdomyos-zwift

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

Domyos connected cyclette (E-Fold) #22

Closed cagnulein closed 3 years ago

cagnulein commented 3 years ago

@alpat59 let's continue here 👍

cagnulein commented 3 years ago

@alpat59 i did generate a similar issue on raspberry 3. It happens when bluez is not update. Please be sure that you run

$ sudo apt upgrade

do a pull and use this commit https://github.com/cagnulein/qdomyos-zwift/commit/a7dcac02df0c307054734ec7c77dbb0738fb4c52

after the ugprade do a reboot cycle and starts again my software.

IT'S VERY IMPORTANT THAT, WHEN YOU RESTART MY SOFTWARE FOR ANY REASON, RESTART ZWIFT TOO. PUSHING THE BUTTON ON ZWIFT IN ORDER TO CONNECT AND DISCONNECT DOESN'T WORK i guess it's a zwift bug on android.

firetrappe commented 3 years ago

I bought a Pi3 today to test this with my Bike 500. I'll test and report back in the next few days. Hoping to get a stand-alone bridge working.

Great work everyone, Simon.

cagnulein commented 3 years ago

@alpat59 could you please test this binary? it just a bluetooth bridge to zwift with random data. It will be useful to me to understand if you have some issue releated on bluetooth on your raspberry.

So unzip it, start it, open zwift and try to connect to the bridge as you usually did. Let me know

You should see something like in my image

qdomyos-zwift-test-zwift-bike.zip Screenshot_20201031_122134_com.zwift.zwiftgame.jpg

alpat59 commented 3 years ago

@cagnulein I just tested last commit ... great job! cadenza is connected and rpm are absolutely precise and aligned to the bike. Due to ftms compliance, I expect to see a similar good behavior also with other ftmes-compliant apps (like Rouvy, RGT, ONelap ...) . I'll test with those.. Anyway without -no-write, no connection is possible yet. Thank you ..

cagnulein commented 3 years ago

@cagnulein I just tested last commit ... great job! cadenza is connected and rpm are absolutely precise and aligned to the bike. Due to ftms compliance, I expect to see a similar good behavior also with other ftmes-compliant apps (like Rouvy, RGT, ONelap ...) . I'll test with those.. Anyway without -no-write, no connection is possible yet. Thank you ..

@alpat59 wow! great debug team! about -no-write-resistance: i guess it just a coincidence because i don't use it anymore in the code. i guess now there are sometimes some issues about connection (i saw them too on my treadmill, i have to understand them)

cagnulein commented 3 years ago

@firetrappe did your raspi arrive? @kenands are you still moving? we need more hands to debug it :laughing: @alpat59 was the only one sweating here :rofl:

Yusuf-Demiryurek commented 3 years ago

@cagnulein , it takes more time that I expected 😄 I will do a try this evening. Have a good day !

firetrappe commented 3 years ago

@firetrappe did your raspi arrive?

@cagnulein Yes, it arrived. It's all new to me, so took a while to setup. I configured the Pi as headless by enabling SSH and VNC. Then connecting over Wi-Fi using VNC Viewer to test. From booting the Pi I have to open Terminal then cd qdomyos-zwift cd src sudo ./qdomyos-zwift

It all works and works really well! I am so impressed.

I'm now trying to figure out how to autostart the bridge on boot. I've read that there are a few different ways to do this. I'd also like to keep using the GUI version so that I can connect using VNC viewer from my PC if I want to. If I can work that out, then i'll attempt to get a Bluetooth HCI snoop log from my Reebok treadmill.

cagnulein commented 3 years ago

@alpat59 could you please try https://github.com/cagnulein/qdomyos-zwift/commit/bee124bdcf13216aed3087ce0c9ed54b208def3e ? i removed the HR service as i said on Messenger in order to have a better compatibility with FTMS external apps.

Let me know

@firetrappe which device do you use as zwift client?

firetrappe commented 3 years ago

@firetrappe which device do you use as zwift client?

@cagnulein i mostly use an old iPad

firetrappe commented 3 years ago

I have had problems tonight.

The Bike 500 is connecting to the bridge, but Zwift is not detecting the bridge - log file attached. On one occasion I did get Zwift to recognise the bike, but my avatar didn't move. I checked the logs and the bridge was connected, but all fields were zero apart from 'resistance'.

I'll experiment further tomorrow.

debug-Tue Nov 3 01-20-55 2020.log

cagnulein commented 3 years ago

@firetrappe Just to understand: the day before yesterday works and yesterday doesn't? Did you change something in your setup? Of course, I guess, you are now on the last commit. Could you please try to run again the commit that worked the day before yesterday, just to be sure? Thanks

Yusuf-Demiryurek commented 3 years ago

@cagnulein I tried Yesterday and get this error: IMG_20201103_004300

Like @firetrappe I use now raspberry headless because I don't have screen in my basement there where is the bike. I tried with xrdp in windows remote desktop, with putty in ssh and vnc but in every try I get the same error. I tried with the last commit. Thanks

cagnulein commented 3 years ago

@kenands that error is releated to a problem on bluetooth low level communication i guess releated to the distance between the raspberry to the cyclette. Try to reduce the distance and attach me a full log: so we can see the RSSI.

cagnulein commented 3 years ago

@firetrappe @alpat59 you could download this app https://apps.apple.com/it/app/nrf-connect/id1054362403 in order to check if everything works on bridge side. This app is the very useful in order to understand if is a zwift issue, an iOS issue or a bridge issue.

Yesterday @alpat59 tried with an iphone and an ipad: the iphone works, the ipad didn't, so i'm start thinking some issue on the iPad side.

Maybe is the case to open an iPad releated issue in order to keep the issue clean..

firetrappe commented 3 years ago

@firetrappe Just to understand: the day before yesterday works and yesterday doesn't? Did you change something in your setup? Of course, I guess, you are now on the last commit. Could you please try to run again the commit that worked the day before yesterday, just to be sure? Thanks

@cagnulein The only thing I did when I was having issues was to delete the qdomyos-zwift dir and start again with the latest commit. I've tested again quickly this morning before I go to work. Zwift connected to the bridge immediately, but again, no avatar movement - log attached. I'm charging up an old iphone which I will test tonight. debug-Tue Nov 3 07-24-12 2020.log

cagnulein commented 3 years ago

@firetrappe on your last log there is no movement, just a change of the resistance level. Did you move the pedals?

Tue Nov 3 07:26:13 2020 Current speed: 0
Tue Nov 3 07:26:13 2020 Current cadence: 0
Tue Nov 3 07:26:13 2020 Current resistance: 2
Tue Nov 3 07:26:13 2020 Current heart: 0
Tue Nov 3 07:26:13 2020 Current KCal: 0
Tue Nov 3 07:26:13 2020 Current Distance: 0
Tue Nov 3 07:26:13 2020 Current CrankRevs: 0
firetrappe commented 3 years ago

@firetrappe on your last log there is no movement, just a change of the resistance level. Did you move the pedals?

Tue Nov 3 07:26:13 2020 Current speed: 0 Tue Nov 3 07:26:13 2020 Current cadence: 0 Tue Nov 3 07:26:13 2020 Current resistance: 2 Tue Nov 3 07:26:13 2020 Current heart: 0 Tue Nov 3 07:26:13 2020 Current KCal: 0 Tue Nov 3 07:26:13 2020 Current Distance: 0 Tue Nov 3 07:26:13 2020 Current CrankRevs: 0

@cagnulein Yes, I was pedaling to try and make my avatar move. This is the same issue I mentioned yesterday on the occasion that zwift connected to the bridge.

cagnulein commented 3 years ago

@firetrappe in this case there is something from the bike to the raspberry because the bike send

f0 bc 00 00 00 00 00 00 00 00 00 00 00 00 02 00 01 00 00 00 00 00 08 00 00 b7

so it all to 00, means everything it stops.

So i need a little help from you: you have to understand if there is any connection between this behaviour and, i don't know, something you do on the bike. For example, starts the bike and then the bridge and check if the issue subsist. Then, this time, starts the bridge first and then the bike...something like that.

You don't need to start zwift in order to understand this issue, because zwift it's not releated to it. It's the very first time i saw this behaviour

firetrappe commented 3 years ago

@cagnulein Yes, I understand. I was testing different combinations of connecting yesterday but I didn't document the results. I will do some testing later.

The Bike 500 is 'self-powered', so until you pedal for a few seconds the bike's console and bluetooth aren't powered. Also if you stop pedaling for a few minutes then the bike shuts down. The latest log I attached was the following order..

  1. Power on RasPi
  2. VNC from windows machine and start bridge
  3. Pedal Bike 500 to power on console/bt
  4. Open Zwift on iPad - Zwift automatically pairs.

This is very new to me. Is is possible to corrupt files on Pi by removing power while the bridge is running? I realise that log files can become corrupt.

cagnulein commented 3 years ago

@firetrappe

The Bike 500 is 'self-powered', so until you pedal for a few seconds the bike's console and bluetooth aren't powered. Also if you stop pedaling for a few minutes then the bike shuts down. The latest log I attached was the following order..

wow! i didn't know! great feature ;)

Is is possible to corrupt files on Pi by removing power while the bridge is running? I realise that log files can become corrupt.

yes it's possible, but if a executable (as qdomyos-zwift) has been corrupted it will never start, so it will be very visible :)

Yusuf-Demiryurek commented 3 years ago

@cagnulein I tried again and it works well except the heart rate service (zwift doesn't see it). Zwift see that the bike is controlable but I'm novice on zwift so I don't know how to test it from zwift yet. I don't know why but the bluetooth issue was related to on other domyos bike 1627 like a few days ago (mine is 1175), I don't think someone on my new neighboorhood have a domyos bike again, raspeberry still seeing this bike lol. So I run the app with name parameter. @firetrappe On my bike 500, I need to push on the start (OK) button to begin the session.

debug-mar. nov. 3 13:01:49 2020.log

Thanks !

cagnulein commented 3 years ago

@kenands thanks for sharing your log! Yeah, I removed the heart service for giving more compatility to FTMS protocol but if zwift doesn't get it I will reintroduce it (I guess I can add a parameter to disable it).

Great tip about the "start" button, @firetrappe let us know!

firetrappe commented 3 years ago

@firetrappe On my bike 500, I need to push on the start (OK) button to begin the session.

Ah, that might be it! I will try later, thank you!

@kenands Do you get the full console display like this while using zwift?

500_self-powered_exercise_bike_domyos_by_decathlon_8503088_1742058

This morning I was just getting the bluetooth symbol in the middle of the console and the resistance icon and setting at the bottom left.

Edited : Created new issue.. apologies.

cagnulein commented 3 years ago

@firetrappe i run it on autostart on fluxbox, but it's better to open a dedicated issue in order to keep this one clean. Thanks :)

cagnulein commented 3 years ago

@kenands i've just readded the HR service. @alpat59 if you want to try without the heart service just add to the executable -no-heart-service

Yusuf-Demiryurek commented 3 years ago

@cagnulein ok thanks :) @firetrappe yes i get nearly the full console (except the chart).

firetrappe commented 3 years ago

@cagnulein I just got home and tested. As before, I started the bridge, powered the bike and then opened Zwift. This time zwift detected the bike after a couple of seconds. I started a 'ride' session and my avatar wasn't moving again. I tried pushing the 'start' button on the bike console, but it didn't appear to do anything.

I tried again. This time powering the bike first, then starting the bridge and then opening Zwift. As before, zwift detected the bike and my avatar actually started moving very slowly (the avatars legs were going quite quickly - as were mine!) but the avatar was only crawling along.

I'll do some more proper testing later, but for now here is the log from that session. debug-Tue Nov 3 16-47-35 2020.log

firetrappe commented 3 years ago

I think I might have found part of the issue with my above post. It appears that someone nearby is using another bluetooth smart trainer! It could be that Zwift was connecting to that :/ I need to pay more attention.

IMG_0328

firetrappe commented 3 years ago

Apologies for cluttering this thread. I'm happy to remove any of these posts, or move them to a new issue. Just ask.

Below are images of nRF Connect running on my phone, my zwift connections and also my avatar (not moving). I hope these give some clues.

Screenshot_20201103-173837 PXL_20201103_174118897 LS_exported_40_1604425647220 PXL_20201103_174220736

Yusuf-Demiryurek commented 3 years ago

@firetrappe it is maybe something similar to my last issue, try with the name paramater as below: sudo ./qdomyos-zwift -name Domyos-Bike-0556

cagnulein commented 3 years ago

@firetrappe i will check the log tomorrow. Feel always free to post everything that could be useful to understand the issue! We are a great debug team! :)

firetrappe commented 3 years ago

More testing using nRF Connect on my Pixel 4a....

Pedal bike to switch on. Full console display on bike and nRF detects Bike 500. Power on RasPi - no change. Start bridge from PC. Bridge appears on nRF refresh, but Bike 500 disappears. Console on bike changes to only BT symbol and Resistance. Only +/- resistance buttons appear to do anything on the bike console. Remove power from RasPi. After ~10 seconds bike console reverts to full display and nRF now can detect bike BT again.

Edit: I replicated the above process but this time stopped the bridge rather than removing power to the Pi. This prevented the log file from being corrupted - attached.

debug-Tue Nov 3 22-49-36 2020.log

cagnulein commented 3 years ago

@firetrappe for the display i guess i need a bt snoop because is quite different from the @kenands one, don't you think? open another issue with the snoop, please

cagnulein commented 3 years ago

Start bridge from PC. Bridge appears on nRF refresh, but Bike 500 disappears. Console on bike changes to only BT symbol and Resistance. Only +/- resistance buttons appear to do anything on the bike console. Remove power from RasPi. After ~10 seconds bike console reverts to full display and nRF now can detect bike BT again.

ok this is the correct behaviour, i mean the bluetooth behaviour.

cagnulein commented 3 years ago

PXL_20201103_174220736

@firetrappe one thing i don't understand. in this zwift screen, if you move the pedals, the data are correct?

firetrappe commented 3 years ago

@firetrappe one thing i don't understand. in this zwift screen, if you move the pedals, the data are correct?

If I remember correctly, moving the pedals had no effect on the data on that screen. Watts and Rpm remained zero.

cagnulein commented 3 years ago

If I remember correctly, moving the pedals had no effect on the data on that screen. Watts and Rpm remained zero.

@firetrappe @alpat59 too has a similar ipad issue. do you have other device to test on zwift? anyway could you please try the last commit and send me the logs? alpat59 said that iphone works well.

@kenands i saw you on zwift this morning :D one question: is the resistance controlled by zwift now or it doesn't work yet?

firetrappe commented 3 years ago

@firetrappe @alpat59 too has a similar ipad issue. do you have other device to test on zwift? anyway could you please try the last commit and send me the logs? alpat59 said that iphone works well.

@cagnulein I have a cheap Lenovo android tablet, my Pixel phone and an iphone 7 plus that I can test on. I have a feeling that the iPad (or another device) may be stealing the connection or connecting in the background. I have seen a few times while using nRF that 'iBeacon' briefly appears.

I may uninstall zwift from my devices and start again. I have tried to find a method of removing 'known devices' from Zwift on the iPad, but no luck so far.

Thank you again for your hard work and patience!

Yusuf-Demiryurek commented 3 years ago

If I remember correctly, moving the pedals had no effect on the data on that screen. Watts and Rpm remained zero.

@firetrappe @alpat59 too has a similar ipad issue. do you have other device to test on zwift? anyway could you please try the last commit and send me the logs? alpat59 said that iphone works well.

@kenands i saw you on zwift this morning :D one question: is the resistance controlled by zwift now or it doesn't work yet?

@firetrappe for me, when I move pedals, data are updated on this screen. Also, I said a mistake, it's not necessary to push ok button, values begin to move after 3-4 seconds of pedaling.

@cagnulein I did my first long session :) The resistance is recognized by zwift but in this session, zwift didn't change it. During the session, 4 times zwift companion lost the bluetooth from the bridge (1st time happened 35 min after the start) , app did not crash and data on the screen of the bike was correct but I had to restart the app to the connection works again between zwift companion and the bridge. My config: Raspberry Pi4 for the bridge Xiaomi mi9 for zwift companion app Lenovo x230 for zwift Zwift on my laptop doesn't see bluetooth from the bridge that's why I used zwift companion for the connection.

On the console of the bike, value of kcal seems not correct.

Distance doesn't display.

Heart rate is ok.

I'm not at home, I will send the logs this evening :)

Many thanks again for this great work :)

cagnulein commented 3 years ago

The resistance is recognized by zwift but in this session, zwift didn't change it.

Did you select the icon on the start menu about the resistance control? i guess so. In case we will see it in the log

During the session, 4 times zwift companion lost the bluetooth from the bridge (1st time happened 35 min after the start) , app did not crash and data on the screen of the bike was correct but I had to restart the app to the connection works again between zwift companion and the bridge.

Very strange, the log will clarify this problem too

Zwift on my laptop doesn't see bluetooth from the bridge that's why I used zwift companion for the connection.

Windows 10? It doesn't see at all? This is new :) i try to install on a W10 machine too and i'll try. I'll open a separate bug about it

On the console of the bike, value of kcal seems not correct.

i will look into it

Distance doesn't display.

i will look into it too

Many thanks again for this great work :)

Thank you for your time and patience!

cagnulein commented 3 years ago

@kenands i guess i fixed distance and calories on the console in the last commit. Let me know

firetrappe commented 3 years ago

@firetrappe for me, when I move pedals, data are updated on this screen. Also, I said a mistake, it's not necessary to push ok button, values begin to move after 3-4 seconds of pedaling.

@kenands Thank you for the info. No problem about the 'ok' button. It was something I hadn't thought of trying so was worth investigating.

Yusuf-Demiryurek commented 3 years ago

@cagnulein Yes control resistance icon was selected. below, logs of this morning session: debug-mer. nov. 4 10:19:16 2020.log debug-mer. nov. 4 11:03:31 2020.log debug-mer. nov. 4 11:36:21 2020.log debug-mer. nov. 4 11:46:42 2020.log

I tried the last commit: Kcal is ok Distance is displayed but value stay to 0 log: debug-mer. nov. 4 22:39:05 2020.log

I ordered domyos treadmill intense run :smile: Now, I have no excuse to not do workout haha

thanks !

cagnulein commented 3 years ago

@kenands hahaha great! I will challenge you on a 10km :D I will have a look to the log today. Thanks

cagnulein commented 3 years ago

During the session, 4 times zwift companion lost the bluetooth from the bridge (1st time happened 35 min after the start) , app did not crash and data on the screen of the bike was correct but I had to restart the app to the connection works again between zwift companion and the bridge.

looking into the logs i discovered that the connection hangs because an error and the docs said

An unknown error has occurred.

So there is not much do on it :D i guess there is some interference or something like this. Try to reduce the distance between the raspberry from the device you use to connect to the raspberry.

Do you have the same issue with windows too? I already managed this error, so i put myself in a state of reconnection, but in this case i'm a slave from zwift point of view, so i can't do anything to force a reconnection.

cagnulein commented 3 years ago

Distance is displayed but value stay to 0

fixed on the last commit @kenands

Yusuf-Demiryurek commented 3 years ago

@kenands hahaha great! I will challenge you on a 10km :D I will have a look to the log today. Thanks

I need few trainings before :) , I'm not sure I can do a 10km yet but it's a good idea :D

During the session, 4 times zwift companion lost the bluetooth from the bridge (1st time happened 35 min after the start) , app did not crash and data on the screen of the bike was correct but I had to restart the app to the connection works again between zwift companion and the bridge.

looking into the logs i discovered that the connection hangs because an error and the docs said

An unknown error has occurred.

So there is not much do on it :D i guess there is some interference or something like this. Try to reduce the distance between the raspberry from the device you use to connect to the raspberry.

Do you have the same issue with windows too? I already managed this error, so i put myself in a state of reconnection, but in this case i'm a slave from zwift point of view, so i can't do anything to force a reconnection.

It's a very speaking error lol The raspberry was at 1.5 meters from the phone. Not yet, with Windows, I tried just few minutes , I will do a long session this night to see if it's happen again.

Thanks :)

cagnulein commented 3 years ago

@cagnulein Yes control resistance icon was selected.

i added some code to the control resistance https://github.com/cagnulein/qdomyos-zwift/commit/53fde43c3cbe875a9658dad1bbb3c5ad7756dcc3

try it and post me the log.

Yusuf-Demiryurek commented 3 years ago

@cagnulein Hi, i just finished an one hour session without disconnection :smile: (connected directly with windows 10 zwift app)

few issues: Resistance it's not controlled yet by zwift few times power falls to 0 on zwift but cadence was displayed value of speed on bike display was not correct at begining it was 25, after was sometimes to 0 or 4 distance stay at 0

I thinking now, maybe I'm not use the correct version of your app, I downloaded the last commit. Maybe your change was only in 53fde43, I don't know how I can dowload a specific version of your app, could you explain me ? (sorry, I'm novice in git)

below the log: debug-jeu. nov. 5 21:26:09 2020.log

Great work again, for me app at this step is usable for long session :smile: Thanks !