360manu / kettlerUSB2BLE

Bridge from USB to Bluetooth low energy for old Kettler Trainers (Ergorace, ..) for Zwift and other apps
MIT License
38 stars 28 forks source link

Connects but does not read #18

Open laviniug opened 3 years ago

laviniug commented 3 years ago

Hi,

I have a Kettler Ergometer E3. I downloaded the image to a pi zero W, connected the usb from the back through an OTG adapter to the microusb and I can connect to it but it doesn't read any data. Tried 9600 and 57600 boudrate. This is the log:

sudo /usr/local/bin/node server.js

[BikeState starting]
[KettlerUSB] constructor
[KettlerUSB] open
[KettlerBLE starting]
Kettler app listening on port 3000!
[KettlerUSB] write : VE
[KettlerBLE stateChange] new state: poweredOn
[KettlerUSB] write : ID
[KettlerBLE advertisingStart] success
[KettlerBLE servicesSet] success
[KettlerBLE setServices] success
[KettlerUSB] write : VE
[KettlerUSB] write : KI
[KettlerUSB] write : CA
[KettlerUSB] write : RS
[KettlerUSB] write : CM
[KettlerUSB] write : SP1
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST

Any advice?

Thanks, L

laviniug commented 3 years ago

Also tried on a pi4 with a manually built app on a standard image, no luck, same behavior even though I'm connecting with a normal cable directly to the USB:


sudo node server.js
[BikeState starting]
[KettlerUSB] constructor
[KettlerUSB] open
[KettlerBLE starting]
Kettler app listening on port 3000!
(node:1779) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[KettlerUSB] write : VE
[KettlerBLE stateChange] new state: poweredOn
[KettlerBLE advertisingStart] success
[KettlerBLE servicesSet] success
[KettlerBLE setServices] success
[KettlerUSB] write : ID
[KettlerUSB] write : VE
[KettlerUSB] write : KI
[KettlerUSB] write : CA
[KettlerUSB] write : RS
[KettlerUSB] write : CM
[KettlerUSB] write : SP1
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
[KettlerUSB] write : ST
360manu commented 3 years ago

Hello

Not very easy 😁 I would suggest the following:

Le lun. 20 sept. 2021 à 12:22, laviniug @.***> a écrit :

Hi,

I have a Kettler Ergometer E3. I downloaded the image to a pi zero W, connected the usb from the back through an OTG adapter to the microusb and I can connect to it but it doesn't read any data. Tried 9600 and 57600 boudrate. This is the log:

sudo /usr/local/bin/node server.js

[BikeState starting] [KettlerUSB] constructor [KettlerUSB] open [KettlerBLE starting] Kettler app listening on port 3000! [KettlerUSB] write : VE [KettlerBLE stateChange] new state: poweredOn [KettlerUSB] write : ID [KettlerBLE advertisingStart] success [KettlerBLE servicesSet] success [KettlerBLE setServices] success [KettlerUSB] write : VE [KettlerUSB] write : KI [KettlerUSB] write : CA [KettlerUSB] write : RS [KettlerUSB] write : CM [KettlerUSB] write : SP1 [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST [KettlerUSB] write : ST

Any advice?

Thanks, L

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/360manu/kettlerUSB2BLE/issues/18, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADACXMLBXG6OWIDV5GDJ5M3UC4DNZANCNFSM5ELUA4UA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

laviniug commented 3 years ago

The bike works fine with Kettler world tour and http://ergo.ub-online.de but my new phone doesn't have ant+ 🤦 and I wanted to skip the phone as a proxy.

Both pi zero w and pi4 behave in the same way and they create /dev/ttyUSB0. The bike wakes up when it's plugged in too.

Any idea how I can debug it (also a developer)?

Thanks

360manu commented 3 years ago

OK.

With my bike, it wakes up when opening the Serial port. You can show that the bike is in a kind of "slave" state.

If you have the same reaction. I would suggest something like increasing the timeout delay between the initialisation commands. line 176 (file KettlerUSB.js) can you try to change 150 to 2000 for ex. and let some times for your bike to answer.

from this website, I can see that somebody was able to communicate with his E3 and using the same commands. http://technomathematik.blogspot.com/2013/10/ergometer-kettler-fx1-serial-protocol.html

laviniug commented 3 years ago

Can't figure it out, it doesn't read anything from the bike, regardless of what I write and the settings.

MacAgent commented 2 years ago

Hi laviniug,

did you ever found a solution? I’m faced with the same problem, no data from my Kettler Ergometer E5.

MacAgent commented 1 year ago

I'm running your KettlerBLE on a PI 4 and it seams to work so far. But I have the problem as some other users. I can connect via ZWIFT app on my iPad, but after short amount of time it says: No Signal.

Running the server.js in Debug mode show the following:

[BikeState starting] [KettlerUSB] constructor [KettlerUSB] open [KettlerBLE starting] Kettler app listening on port 3000! [KettlerUSB] write : VE [KettlerUSB] read [0] : READYVE [KettlerUSB] Unrecognized packet [KettlerUSB] write : ID [KettlerUSB] read [1998] : ID [KettlerUSB] Unrecognized packet [KettlerUSB] write : ST [KettlerUSB] read [1000] : 101 85 35 002 -1 300 01:12 -1 [KettlerUSB] write : VE [KettlerUSB] read [999] : VE [KettlerUSB] Unrecognized packet [KettlerUSB] write : ST [KettlerUSB] read [1000] : 101 85 35 002 -1 300 01:12 -1 [KettlerUSB] write : KI [KettlerUSB] read [1000] : KI [KettlerUSB] Unrecognized packet [KettlerUSB] write : ST [KettlerUSB] read [1001] : 101 85 35 002 -1 300 01:12 -1 [KettlerUSB] write : CA [KettlerUSB] read [1001] : CA [KettlerUSB] Unrecognized packet [KettlerUSB] write : ST [KettlerUSB] read [1000] : 101 85 35 002 -1 300 01:12 -1 [KettlerUSB] write : RS [KettlerUSB] read [1000] : RS [KettlerUSB] Unrecognized packet [KettlerUSB] write : ST [KettlerUSB] read [1000] : 101 85 35 002 -1 300 01:12 -1 [KettlerUSB] write : CM [KettlerUSB] read [1001] : CM [KettlerUSB] Unrecognized packet [KettlerUSB] write : ST [KettlerUSB] read [1000] : 101 85 35 002 -1 300 01:12 -1 [KettlerUSB] write : SP1 [KettlerUSB] read [1000] : SP1 [KettlerUSB] Unrecognized packet [KettlerUSB] write : ST [KettlerUSB] read [1001] : 101 85 35 002 -1 300 01:12 -1 [KettlerUSB] write : ST [KettlerUSB] read [2001] : 101 85 35 002 -1 300 01:12 -1 and so on.

The date do not change even if use the bike.

MacAgent commented 1 year ago

Hi,

I managed it to read the data from my E5.

Starting the server looks like this

[BikeState starting] [KettlerUSB] constructor [KettlerUSB] open [KettlerBLE starting] Kettler app listening on port 3000! [KettlerUSB] write : VE [KettlerBLE stateChange] new state: poweredOn [KettlerUSB] read [0] : 3579 [KettlerUSB] Unrecognized packet [KettlerBLE advertisingStart] success [KettlerBLE servicesSet] success [KettlerBLE setServices] success [KettlerUSB] write : ID [KettlerUSB] read [177] : SJ10B3579 [KettlerUSB] Unrecognized packet [KettlerBLE accept] Client: 6b:a0:61:06:cd:95 [KettlerUSB] write : VE [KettlerUSB] read [142] : 3579 [KettlerUSB] Unrecognized packet

[KettlerUSB] write : KI [KettlerUSB] read [155] : SJ10B E5 [KettlerUSB] Unrecognized packet [KettlerUSB] write : CA [KettlerUSB] read [149] : 07682-600-0002 [KettlerUSB] Unrecognized packet [KettlerUSB] write : RS [KettlerUSB] read [153] : ACK [KettlerUSB] Unrecognized packet [KettlerUSB] write : CD [KettlerUSB] read [167] : ACK [KettlerUSB] Unrecognized packet [KettlerUSB] write : CM [KettlerUSB] read [130] : RUN [KettlerUSB] Unrecognized packet [KettlerUSB] write : SP1 [KettlerUSB] read [156] : ACK [KettlerUSB] Unrecognized packet [KettlerUSB] write : ST [KettlerUSB] read [1757] : 0 0 0 0 025 0 00:00 0 [KettlerUSB] write : ST [KettlerUSB] read [2002] : 0 0 0 0 025 0 00:00 0 [KettlerUSB] write : ST [KettlerUSB] read [1996] : 0 0 0 0 025 0 00:00 0

and when I use the bike

[KettlerUSB] read [2000] : 0 94 334 1 025 1 00:19 25 [KettlerBLE accept] Client: 6b:a0:61:06:cd:95

[KettlerUSB] write : ST [KettlerUSB] read [2000] : 0 95 337 1 025 2 00:21 25 [KettlerUSB] write : ST [KettlerUSB] read [2001] : 0 94 334 1 025 2 00:23 25 [KettlerUSB] write : ST [KettlerUSB] read [2000] : 0 94 334 1 025 2 00:25 25 [KettlerUSB] write : ST [KettlerUSB] read [2000] : 0 93 330 2 025 2 00:27 25 [KettlerUSB] write : ST [KettlerUSB] read [2003] : 0 92 327 2 025 2 00:29 25 [KettlerUSB] write : ST [KettlerUSB] read [2003] : 0 91 323 2 025 3 00:31 25 [KettlerUSB] write : ST [KettlerUSB] read [2000] : 0 94 334 2 025 3 00:33 25 [KettlerUSB] write : ST [KettlerUSB] read [2001] : 0 95 337 2 025 3 00:35 25 [KettlerUSB] write : ST [KettlerUSB] read [2001] : 0 97 344 2 025 3 00:37 25 [KettlerUSB] write : ST [KettlerUSB] read [1999] : 0 97 344 3 025 3 00:39 25 [KettlerUSB] write : ST [KettlerUSB] read [2002] : 0 99 351 3 025 4 00:41 25 [KettlerUSB] write : ST [KettlerUSB] read [2006] : 0 100 355 3 025 4 00:43 25 [KettlerUSB] write : ST [KettlerUSB] read [1997] : 0 96 341 3 025 4 00:45 25 [KettlerUSB] write : ST [KettlerUSB] read [2003] : 0 90 320 3 025 4 00:47 25 [KettlerUSB] write : ST [KettlerUSB] read [2000] : 0 84 298 4 025 4 00:49 25 [KettlerUSB] write : ST [KettlerUSB] read [1999] : 0 79 280 4 025 5 00:51 25 [KettlerUSB] write : ST [KettlerUSB] read [2008] : 0 72 256 4 025 5 00:53 25 [KettlerUSB] write : ST [KettlerUSB] read [2001] : 0 65 231 4 025 5 00:55 25 [KettlerUSB] write : ST [KettlerUSB] read [2000] : 0 57 202 4 025 5 00:57 25 [KettlerUSB] write : ST [KettlerUSB] read [2002] : 0 47 167 4 025 5 00:59 25 [KettlerUSB] write : ST [KettlerUSB] read [2000] : 0 35 124 4 025 6 01:01 25 [KettlerUSB] write : ST [KettlerUSB] read [2000] : 0 39 138 4 025 6 01:03 25 [KettlerUSB] write : ST [KettlerUSB] read [2003] : 0 29 103 4 025 6 01:05 25 [KettlerUSB] write : ST [KettlerUSB] read [2000] : 0 16 57 4 025 6 01:07 25 [KettlerUSB] write : ST [KettlerUSB] read [2000] : 0 16 57 5 025 6 01:09 25 [KettlerUSB] write : ST [KettlerUSB] read [1998] : 0 0 0 5 025 7 01:10 0 [KettlerUSB] write : ST [KettlerUSB] read [2002] : 0 26 92 5 025 7 01:12 25 [KettlerUSB] write : ST [KettlerUSB] read [2000] : 0 32 114 5 025 7 01:14 25 [KettlerUSB] write : ST [KettlerUSB] read [2002] : 0 40 142 5 025 7 01:16 25 [KettlerUSB] write : ST [KettlerUSB] read [2001] : 0 45 160 5 025 7 01:18 25 keyPowerDn [KettlerUSB] write : PW5 [KettlerUSB] read [2000] : 0 51 181 5 025 8 01:20 25 keypause [KettlerUSB] write : PW140 [KettlerUSB] read [2001] : 0 59 209 5 140 8 01:22 25 [KettlerUSB] write : ST [KettlerUSB] read [2001] : 0 65 231 5 140 9 01:24 85 [KettlerUSB] write : ST [KettlerUSB] read [2010] : 0 50 178 5 140 10 01:26 140 keyPowerDn [KettlerUSB] write : PW120 [KettlerUSB] read [1999] : 0 16 57 5 120 11 01:28 140 [KettlerUSB] write : ST [KettlerUSB] read [2002] : 0 36 128 5 120 12 01:29 27 keyPowerDn [KettlerUSB] write : PW7 [KettlerUSB] read [1999] : 0 24 85 5 025 13 01:31 87 keyPowerUp [KettlerUSB] write : PW107 [KettlerUSB] read [2001] : 0 0 0 5 105 13 01:32 0 [KettlerUSB] write : ST [KettlerUSB] read [2001] : 0 11 39 5 105 13 01:33 27

so far kettlerUSB.js is working,

But I cannot see an data on eypress port 3000 and connecting Zwift app via BLE does not reeceive any data (No Signal) and drop the BLE connection.

at the same time I see lines like this in /var/log/syslog

Dec 2 23:48:30 RasPi kernel: [ 1073.044926] Bluetooth: hci0: command 0x0c1a tx timeout

360manu commented 1 year ago

Hello

may I ask you if you are using the latest code or the bin ? I corrected last year some parts of the FTMS protocol. It's not linked to your pb but if will fix another point :) I came back to zwift today and it still works with a PI zero.

That kind of error is mainly linked to the Bluetooth layer installed on your PI4. are you running another software on your pi4 ? (Like media players That can use the Bluetooth) Did you try updating the kernel to the latest version ?

I bought a PI zero to avoid this. The Bleno library is somehow very sensitive

Emmanuel

MacAgent commented 1 year ago

Hello Emmanuel,

Yes I'm using the latest code git clone etc... I really would like to buy a Zero, but the market is currently very empty.

I just right now decided to reinstall my PI4 with the latest 32 Bit OS and to give this a try. I’ll come back here and report the results.

Thanks for you work and help

Jacques

MacAgent commented 1 year ago

First report:

KettlerUSB2BLE is working in PI4 8GB, but (read later)

Debian_Version 11.5 32Bit Linux raspberrypi 5.15.76-v7l+ #1597 SMP Fri Nov 4 12:14:58 GMT 2022 armv7l GNU/Linux

  1. I changed the baud rate from 9600 to 57200 in kettleUSB.js
  2. I was unable to install KettlerUSB2BLE be using the default installed node and npm of Node.js 12.x

npm install . . . npm ERR! code 1 npm ERR! path /home/pi/kettlerUSB2BLE/node_modules/@abandonware/bleno npm ERR! command failed . . and so on

  1. Updated node 12 to 16

Same errors

  1. Uninstall node.js completely and downloaded node-v16.18.1-linux-armv7l.tar.gz Extract it to /opt and created the necessary symlinks for node and npn

    ln -s /opt/node-v16.18.1-linux-armv7l /opt/node ln -s /opt/node/bin/node /usr/bin/node ln -s /opt/node/bin/npm /usr/bin/npm

  2. npm install without erros

    added 458 packages, and audited 459 packages in 55s 12 vulnerabilities (4 moderate, 7 high, 1 critical)

  3. sudo node server.js

[BikeState starting] [KettlerUSB] constructor [KettlerUSB] open [KettlerBLE starting] Kettler app listening on port 3000! (node:5300) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. (Use node --trace-deprecation ... to show where the warning was created) [KettlerUSB] write : VE [KettlerBLE stateChange] new state: poweredOn [KettlerBLE advertisingStart] success [KettlerBLE servicesSet] success [KettlerBLE setServices] success [KettlerUSB] write : ID [KettlerUSB] write : VE [KettlerUSB] write : KI [KettlerUSB] write : CA [KettlerUSB] write : RS [KettlerUSB] write : CM [KettlerUSB] write : SP1 [KettlerUSB] read [0] : 07682-600-0002 [KettlerUSB] Unrecognized packet [KettlerUSB] read [4] : ACK [KettlerUSB] Unrecognized packet [KettlerUSB] write : ST [KettlerUSB] read [559] : 0 0 0 0 025 0 00:00 0

  1. changed Buffer() to Buffer.from() in .\BLE\cycling-power-measurement-characteristic.js line 55 . \BLE\fitness-control-point-characteristic.js line 186 . \BLE\indoor-bike-data-characteristic.js line 42 . \BLE\static-read-characteristic.js line 18

but I'm not sure if this is really necessary!?!?

  1. sudo node server.js

[BikeState starting] [KettlerUSB] constructor [KettlerUSB] open [KettlerBLE starting] Kettler app listening on port 3000! [KettlerUSB] write : VE [KettlerBLE stateChange] new state: poweredOn [KettlerBLE advertisingStart] success [KettlerBLE servicesSet] success [KettlerBLE setServices] success [KettlerUSB] write : ID [KettlerUSB] read [0] : SJ10B3579 [KettlerUSB] Unrecognized packet [KettlerUSB] write : ST [KettlerUSB] read [561] : 0 0 0 0 025 0 00:00 0 [KettlerUSB] write : VE [KettlerUSB] read [995] : 3579 [KettlerUSB] Unrecognized packet [KettlerUSB] write : ST [KettlerUSB] read [1002] : 0 0 0 0 025 0 00:00 0

  1. started cycling

[KettlerUSB] write : ST [KettlerUSB] read [1999] : 0 26 92 0 025 0 00:00 12 [KettlerBLE accept] Client: 72:5e:de:e8:18:57

[KettlerBLE accept] Client: 72:5e:de:e8:18:57

[KettlerBLE accept] Client: 72:5e:de:e8:18:57

[KettlerUSB] write : ST [KettlerUSB] read [1998] : 0 90 320 0 025 0 00:02 25 [KettlerBLE accept] Client: 72:5e:de:e8:18:57

[KettlerBLE accept] Client: 72:5e:de:e8:18:57

[KettlerBLE accept] Client: 72:5e:de:e8:18:57

[KettlerUSB] write : ST [KettlerUSB] read [2006] : 0 103 366 0 025 0 00:04 25 [KettlerBLE accept] Client: 72:5e:de:e8:18:57

[KettlerBLE accept] Client: 72:5e:de:e8:18:57

[KettlerBLE accept] Client: 72:5e:de:e8:18:57

[KettlerUSB] write : ST [KettlerUSB] read [1993] : 0 99 351 0 025 0 00:06 25 [KettlerBLE accept] Client: 72:5e:de:e8:18:57

[KettlerBLE accept] Client: 72:5e:de:e8:18:57

[KettlerBLE accept] Client: 72:5e:de:e8:18:57

[KettlerUSB] write : ST [KettlerUSB] read [2003] : 0 94 334 0 025 0 00:08 25

Well done so far.

I successfully connected ZWIFT (IOS) to KettlerBLE and it worked ... for a minute or so. Zwift is continuing losing the KettlerBLE connection and then reconnect again and so on...

● bluetooth.service - Bluetooth service Loaded: loaded (/lib/systemd/system/bluetooth.service; disabled; vendor preset: enabled) Active: active (running) since Sat 2022-12-03 13:09:24 CET; 4s ago Docs: man:bluetoothd(8) Main PID: 12197 (bluetoothd) Status: "Running" Tasks: 1 (limit: 4915) CPU: 55ms CGroup: /system.slice/bluetooth.service └─12197 /usr/libexec/bluetooth/bluetoothd --noplugin=sap

Dec 03 13:09:24 raspberrypi systemd[1]: Starting Bluetooth service... Dec 03 13:09:24 raspberrypi bluetoothd[12197]: Bluetooth daemon 5.55 Dec 03 13:09:24 raspberrypi systemd[1]: Started Bluetooth service. Dec 03 13:09:24 raspberrypi bluetoothd[12197]: Starting SDP server Dec 03 13:09:24 raspberrypi bluetoothd[12197]: Excluding (cli) sap Dec 03 13:09:24 raspberrypi bluetoothd[12197]: Bluetooth management interface 1.21 initialized Dec 03 13:09:24 raspberrypi bluetoothd[12197]: Failed to set privacy: Rejected (0x0b) Dec 03 13:09:24 raspberrypi bluetoothd[12197]: Endpoint registered: sender=:1.24 path=/MediaEndpoint/> Dec 03 13:09:24 raspberrypi bluetoothd[12197]: Endpoint registered: sender=:1.24 path=/MediaEndpoint/> . . Dec 03 13:19:19 raspberrypi bluetoothd[14159]: src/device.c:load_gatt_db() No cache for 72:5E:DE:E8:1> Dec 03 13:21:54 raspberrypi bluetoothd[14159]: src/device.c:load_gatt_db() No cache for 72:5E:DE:E8:1>

Bluetoothctl

[ CHG ] Device 72:5E:DE:E8:18:57 Connected: yes [ CHG ] Device 72:5E:DE:E8:18:57 Connected: no [ CHG ] Device 72:5E:DE:E8:18:57 Connected: yes [ CHG ] Device 72:5E:DE:E8:18:57 Connected: no [ CHG ] Device 72:5E:DE:E8:18:57 Connected: yes [ CHG ] Device 72:5E:DE:E8:18:57 Connected: no [ CHG ] Device 72:5E:DE:E8:18:57 Connected: yes [ CHG ] Device 72:5E:DE:E8:18:57 Connected: no [ CHG ] Device 72:5E:DE:E8:18:57 Connected: yes [ CHG ] Device 72:5E:DE:E8:18:57 Connected: no [ CHG ] Device 72:5E:DE:E8:18:57 Connected: yes

Btmon (devices is 72:5E:DE:E8:18:57 my iPad)

HCI Event: Number of Completed Packets (0x13) plen 5 #426 [hci0] 12.210650 Num handles: 1 Handle: 64 Count: 3 HCI Event: Disconnect Complete (0x05) plen 4 #427 [hci0] 12.210664 Status: Success (0x00) Handle: 64 Reason: Connection Terminated By Local Host (0x16) @ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0002} [hci0] 12.210737 LE Address: 72:5E:DE:E8:18:57 (Resolvable) Reason: Connection terminated by local host (0x02) @ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0001} [hci0] 12.210737 LE Address: 72:5E:DE:E8:18:57 (Resolvable) Reason: Connection terminated by local host (0x02) < HCI Command: LE Set Advertise Enable (0x08|0x000a) plen 1 #428 [hci0] 12.288696 Advertising: Enabled (0x01) HCI Event: Command Complete (0x0e) plen 4 #429 [hci0] 12.289199 LE Set Advertise Enable (0x08|0x000a) ncmd 1 Status: Success (0x00) HCI Event: LE Meta Event (0x3e) plen 19 #430 [hci0] 12.292982 LE Connection Complete (0x01) Status: Success (0x00) Handle: 64 Role: Slave (0x01) Peer address type: Random (0x01) Peer address: 72:5E:DE:E8:18:57 (Resolvable) Connection interval: 22.50 msec (0x0012) Connection latency: 0 (0x0000) Supervision timeout: 720 msec (0x0048) Master clock accuracy: 0x01 @ MGMT Event: Device Connected (0x000b) plen 13 {0x0002} [hci0] 12.293065 LE Address: 72:5E:DE:E8:18:57 (Resolvable) Flags: 0x00000000 Data length: 0 @ MGMT Event: Device Connected (0x000b) plen 13 {0x0001} [hci0] 12.293065 LE Address: 72:5E:DE:E8:18:57 (Resolvable) Flags: 0x00000000 Data length: 0 < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2 #431 [hci0] 12.293355 Handle: 64 HCI Event: Vendor (0xff) plen 5 #432 [hci0] 12.293359 55 00 00 40 00 U..@. HCI Event: Command Status (0x0f) plen 4 #433 [hci0] 12.293789 LE Read Remote Used Features (0x08|0x0016) ncmd 1 Status: Success (0x00) < HCI Command: Read RSSI (0x05|0x0005) plen 2 #434 [hci0] 12.299620 Handle: 64 HCI Event: Command Complete (0x0e) plen 7 #435 [hci0] 12.300227 Read RSSI (0x05|0x0005) ncmd 1 Status: Success (0x00) Handle: 64 RSSI: -55 dBm (0xc9) HCI Event: LE Meta Event (0x3e) plen 12 #436 [hci0] 12.344881 LE Read Remote Used Features (0x04) Status: Success (0x00) Handle: 64 Features: 0x3f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 LE Encryption Connection Parameter Request Procedure Extended Reject Indication Slave-initiated Features Exchange LE Ping LE Data Packet Length Extension . . . HCI Event: Disconnect Complete (0x05) plen 4 #42 [hci0] 11.764419 Status: Success (0x00) Handle: 64 Reason: Remote User Terminated Connection (0x13) @ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0002} [hci0] 11.764476 LE Address: 72:5E:DE:E8:18:57 (Resolvable) Reason: Connection terminated by remote host (0x03) @ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0001} [hci0] 11.764476 LE Address: 72:5E:DE:E8:18:57 (Resolvable) Reason: Connection terminated by remote host (0x03) < HCI Command: LE Set Advertise Enable (0x08|0x000a) plen 1 #43 [hci0] 11.868664 Advertising: Enabled (0x01) HCI Event: Command Complete (0x0e) plen 4 #44 [hci0] 11.869299 LE Set Advertise Enable (0x08|0x000a) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Advertise Enable (0x08|0x000a) plen 1 #45 [hci0] 14.260705 Advertising: Disabled (0x00) HCI Event: Command Complete (0x0e) plen 4 #46 [hci0] 14.261677 LE Set Advertise Enable (0x08|0x000a) ncmd 1 Status: Success (0x00)

360manu commented 1 year ago

Here is what I have on my PI Zero (with Debug = false for KettlerUSB.js)

[BikeState starting] [KettlerUSB] constructor [KettlerUSB] open [KettlerBLE starting] Kettler app listening on port 3000! [KettlerBLE stateChange] new state: poweredOn [KettlerBLE advertisingStart] success [KettlerBLE servicesSet] success [KettlerBLE setServices] success [KettlerBLE accept] Client: 7a:d5:99:81:1d:52

OnReadRequest : Fitness Machine Feature [server.js] - Bike is under control [server.js] - Bike reset [server.js] - Bike is under control

it seems that when your pi4 accept the connection there is something that stops the process. that's weird as there is no display of Disconnetion event on the serve.js

Some suggestions : 1) low signal quality ? RSSI = -90 is very low for BLE it's something like 10 meters away I had issue with my first RPI Zero, as I scratched the BLE antenna while soledring resulting in poor quality communications.

2) Oled object is causing trouble (as you probably did not connect it) but never had issue with this

3) Node.js ? Or Kernel version I am working on node 8 !

MacAgent commented 1 year ago

Hello,

1. My iPad is normaly not more than 2 meter away from the Pi.

  1. No I do not have an OLED Display, bur it‘s working with my LCD too

  2. kernel 5.15-80 (latest)     node-v16.18.1-linux-armv7l Version 8 is not working on Debain 11.5 I tryed all the versiona, but only 14 and 16 where able to insall the modules and start server.js

As I already said, I can connect an I can use Zwift for few moments, then I loose the bluetooth connection and after few seconds the goes Up and Down. Sometime I can connect but just see Watts and sometime I see Watts, Puls, Rpm, etc. It is a bit strange as I cannot reproduce the way how it works.Today I was able to connect to all data sources and later on, without any changes, or reboot, or service restarts, I could still connect, but I just saw the Watts…

unfortunately I’m not good at JavaScript to fully understand what is happening in the background.

I’ll keep trying and do my best :) I also try to find a Pi zero W ;)

For the moment, the biggest problem I see, is a stable Bluetooth connection. 

Jacques

laviniug commented 1 year ago

I gave up on this and bought this app: http://ergo.ub-online.de/index.php/en/konfiguration-en/kettler

It works but it's a bit buggy, I have to restart my phones usually between sessions

MacAgent commented 1 year ago

I gave up on this and bought this app: http://ergo.ub-online.de/index.php/en/konfiguration-en/kettler

I tried the Testversion on an older Samsung A5 and it worked very well and stable. Running kettlerBLE on a newer Pi4 is possible, but I'm still struggling with a nonstable Bluetooth connection. For the moment I stop here and wait until I could garb a Zero somewhere :)

cheers Jacques

Thank you

Jacques