kariudo / onewheel-bluetooth

A python bluetooth data reader for the Onewheel (supporting Gemini firmware, and later).
30 stars 5 forks source link

Zero values when connecting #1

Closed mherfurt closed 3 years ago

mherfurt commented 5 years ago

Hi Hunter, I was following the ponewheel thread the gemini handshake. In order to replicate the process in my app, I ran your python implementation. Are you aware, that your prototype implementation only works, if the official app was connected to the board shortly before connecting with your app? When I connect with your python app, all the return values are all set to zero.

I am looking forward to hearing from you!

Cheers, Martin

kariudo commented 5 years ago

I'm sure it works, it is important to note that each "authentication" is good for something like 25 seconds.

As mentioned in the code: https://github.com/kariudo/onewheel-bluetooth/blob/master/readdata.py#L58

mherfurt commented 5 years ago

Thanks for looking into this. Setup: Freshly restarted OneWheel+ with Gemini firmware and no other peers connected. Client is Ubuntu 18.04 with bluez library. Using the latest code from this repo, I get the following output:

$ time python readdata.py 50:65:83:XX:XX:XX
Requesting encryption key...
Waiting for encryption key...
Sending unlock key...
Reading Onewheel status:
Battery Remaining: 0%
Lifetime Odometer: 0 Miles
Trip Odometer: 0 Miles

real    0m9,618s
user    0m0,141s
sys 0m0,138s

Now, I am connecting with the official app and disconnect it immediately. Within the 25 seconds, I call your script again:

$ time python readdata.py 50:65:83:XX:XX:XX
Requesting encryption key...
Sending unlock key...
Reading Onewheel status:
Battery Remaining: 100%
Lifetime Odometer: 2 Miles
Trip Odometer: 0 Miles

real    0m9,752s
user    0m0,235s
sys 0m0,115s

When the 25s time frame is over, I get zero values again, when I use your script (same as above). Besides the fact, that the displayed lifetime odometer mileage does not match the one in the app, it seems that the unlock mechanism in your script does not work as assumed.

I hope you can give me some advise.

Thank you!

coolkingcole commented 5 years ago

Make sure you use python3.