-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
Please implement Bluetooth support #103
Comments
There are multiple sides to this
But it's noted as a feature request and if anyone likes to do a code-suggestion; I will gladly integrate into the code. |
I'll +1 this. Adding Bluetooth support opens up the possibility of using more hardware such as phones, tablets/iPads and things like AppleTV that don't support ANT+ but run Zwift and other apps well. Lots of work though. |
On Linux it should be no problem to create a BLE GATT server via bluez, on windows/mac no idea. Protocol seems to be the same as used for ANT+ |
pybluez ?It's multi platform. https://github.com/karulis/pybluez
|
BLE part which is required to implement GATT is linux only and experimental. Microsoft has a documentation how to implement a GATT server with c#. But this would require a python wrapper which would cause additional effort. |
I'm interested in this feature since i have a tacx fortius (T1932) trainer laying around but no ant+ dongles (and my macbook only has only 2 usb ports.. 🙄) Let me see if i can put something together. |
Hi Wouter, I took the challenge and tried to get Bluetooth (BLE) working this weekend. I just rode my first couple of meters in Zwift on my Apple TV by running FortiusANT with BLE support on my MacBook. I'm Zwifting from Nijmegen btw. Ok, so instead of implementing Bluetooth (BLE) support directly in FortiusANT i chose to handle the BLE functionality as a separate process in NodeJS. At startup, FortiusANT should start the NodeJS server so it can then communicate with it. Instead of writing data to an ANT+ dongle it can now send a message to the NodeJS server which will then handle the BLE stuff. Would you be interested to include the changes in FortiusANT? If so, i would first propose some serious code refactoring tbh. It was quite hard to wrap my head around the code in the current state and fit the BLE part in. Just let me know, i'd be happy to help :) |
Marco; great work, compliments!👍 Als je wilt kunnen we wel een conference call organiseren om door te spreken op welke wijze te integreren |
PS. Welke Tacx heb jij? |
Hi @WouterJD congrats for your work. I came over here due to your comment https://www.strava.com/activities/4273307198. :) |
@marcoveeneman has done investigations; next steps are to engineer and integrate |
@WouterJD Great, then i'll proceed with it. I'm using a Tacx Fortius Multiplayer T1932. I've sent you a message to setup the conference call. |
guys, consider to implement the FE-C profile, too, with BLE, see issue #122 for rationale |
We're working on it and implement stepwise with purpose a full implementation. I'd be curious to know why zwift does not support ANT/FE-C and Rouvy's ANT runs behind on Bluetooth... |
Proposal is to transmit simultaneously on BLE and ANT+. I have to note that not all computers have BLE built in, not even laptops. |
Best would be for Zwift to just support ANT+ FE-C on android tho... Another option would be the NPE Cable ANT+ to BLE converter (https://youtu.be/HvrYcOyd7wA) which does support FE-C control. (Often mentioned in zwift forums). |
As you can see i just opened a pull request where initial support for Bluetooth is added. It is working fine for me, but i would be very interested in results of other users. Please let me know if it works ok for you too or if you encounter any issues. Thanks! |
Great work so far Marco. I've just cloned your PR and had issues to connect to 'Virtual Trainer' either through Tacx Training App or RGT Cycling on Android11 - Pixel3a. Pairing the mobile with the trainer directly asked for the pin connects and disconnects right away. FortiusAnt was started on OSX 10.14.6 > python3 FortiusAnt.py -b -t i-Vortex -g -a Any logs you like to see? BTW, I'm from Germany |
Hi @brauereik welcome in the FortiusANT community! |
Hi @brauereik, thanks for taking the effort in testing my PR! So if i understand correctly FortiusANT did actually start the BLE server and started advertising, nice, good to know that works for someone else as well. To better understand why the connection was dropped there might be some information in a file called ble.log, which should be located in the pythoncode folder. Note that this file is currently overwritten each time you start FortiusANT. Can you provide the log file so i can have a look at it? |
I installed both Tacx Training and RGT on my iPhone and both are connecting with the Virtual Trainer (I am thinking to rename this to FortiusANT for clarity). I guess this is an Android vs iOS issue. I'll have a look if there are some special requirements for Android to connect. |
@brauereik I forgot to ask, what do you mean exactly by |
Hi Wouter, |
Hi TacxBiker, I guess you started the version from #179 right? Currently Wouter and i are very close to finish integrating bluetooth. However this is done in two separate PRs. #179 implements the necessary logic inside FortiusANT python code, while #130 implements the specific bluetooth logic separately, you need both to get it working. When the two versions are merged, bluetooth support should work (note the setup required for starting Bluetooth in the doc folder of #130, we currently consider bluetooth an advanced feature since it requires extra setup for the user at the moment.) |
Ho @TacxBiker I'm always curious to know who I communicate with, where FortiusANT is used and what configuration is used. |
Hi, when starting FortiusANT with bluetooth support I get the following error: 13:42:30,448: ... requests.post() error HTTPConnectionPool(host='localhost', port=9999): Max retries exceeded with url: /ant (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0828A4C0>: Failed to establish a new connection: [WinError 10061] Kan geen verbinding maken omdat de doelcomputer de verbinding actief heeft geweigerd')) It seems the HTTP server for receiving the data from Fortius ANT isn't online Is there a way to check that? |
One step further. To start de server I simply can use this command in de \node folder Node server.js But then unfortunately the next error: C:\Github\FortiusAnt\FortiusANTBLE\FortiusANT-master\node\node_modules@abandonware\bluetooth-hci-socket\lib\usb.js:90 But there should be a right bluetooth device. The bluetooth device I use has the following ID: USB\VID_0A5C&PID_21F1 |
I added a new device in the \bluetooth-hci-socket\lib\usb.js file |
@marcoveeneman you evaluate this? |
FortiusANT receives just like it should the power from the CPT. |
Hi @TacxBiker, I see you got the BLE interface up and running eventually, great! |
@marcoveeneman perhaps add a note in the documentation as long as not implemented. Merry Christmas🚴♀️🚴♀️ |
Hi, trying to get FortiusANT up and running on a raspberry pi 3..... So far FortiusANT starts, callibration works, but bluetooth is not working. Can anybody point me out how to setup and use node.js of the BTLE support? |
@marcoveeneman |
@WouterJD and other contributors, I really appreciate all your work on FortiusAnt. It worked 'out of the box' on Windows with two Ant+ dongles. I can confirm that Bluetooth is working with Linux - tested today with a T1932, Raspberry Pi 3B, Raspbian and Zwift. @marcoveeneman one observation - the python script must be executed from the 'pythoncode' directory i.e. 'sudo python3 ./FortiusAnt.py' not 'sudo python3 ./FortiusAnt/pythoncode/FortiusAnt.py' as stated in the user manual. The python script/application tries to execute the node.js script/application from '../node/' relative to where the python script/application is executed from. In my case it ended up looking for the node.js script/application in '/home/pi/node/' when using 'sudo python3 ./FortiusAnt/pythoncode/FortiusAnt.py'. I have the FortiusAnt python script in '/home/pi/git/FortiusAnt/pythoncode/' |
@hleidecker Is it possible to post a small guide for bluetooth on linux / Paspberry Pi? Or the steps you have done to get it working |
@TacxBiker, with the basic FortiusAnt functionality up and running I did the following to get it working with the Raspberry Pi 3B:
Please note that the system had a lot of stuff already installed ... in my pursuit of upgrading to the latest version of wxPython - I eventually gave up as I never succeeded in building it. Let me know if this works for you. |
@hleidecker I'm always curious to know who I communicate with, where FortiusANT is used and what configuration is used. |
Hi @WouterJD Thanks... I got this working... Connected to Zwift and RGT so far. Also using Golden Cheetah with a usb connection. Just as a side note (not sure if covered before) I am using a Microsoft Surface Pro 4 and only need one BLE dongle for Fortius Ant. The Surface's built in Blue Tooth handles the Zwift Connection. I am also able to connect to it using the companion app... thanks again for this awesome initiative :) |
@StFalagar thanks for your nice words and the update |
Would it be possible to broadcast the data using bluetooth instead of ANT+, no dongle needed in this case.
Thanks a lot for this!
Originally posted by @mruzzon in #61 (comment)
The text was updated successfully, but these errors were encountered: