Code Monkey home page Code Monkey logo

onewheel-bluetooth's Introduction

onewheel-bluetooth

A python bluetooth data reader for the Onewheel (supporting Gemini firmware, and later). This is meant to be a quick example of how to connect and obtain data from the board.

The backend library for bluetooth/gatt interaction is rewritten now with bleak due to a deprecation/lack of ownership of pygatt.

Requirements

Python 3 is required, and the dependencies are included in the requirements.txt.

> pip install -r requirements.txt

Usage

Just run it with your board's address as the first paramater:

> python3 readdata.py XX:XX:XX:XX:XX:XX

You can include -v to get all of the verbose debug output as well.

You should get output like the following:

INFO:root:Battery Remaining: 79%
INFO:root:Lifetime Odometer: 258 Miles
INFO:root:Trip Odometer: 0 Miles

Credits

Thanks to @beeradmoore for the help figuring out the md5 chunks for the serial stream reasponse via the ponewheel issue: ponewheel/android-ponewheel#86 (comment)

onewheel-bluetooth's People

Contributors

kariudo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

onewheel-bluetooth's Issues

Pint support

Hello wanted to ask if this was made to work with the pint too i wanna build a headsup display

BLE Connection?

Hi,
When I execute your script, I can't connect to my onewheel XR

ERROR:root:A device with address --:--:--:--:--:-- could not be found.

I retrieved the MAC address from bluetoothctl on Linux

Any idea?

No module named pygatt

Hey, sorry, this is a Python noob question and I don't like to bother you with it, but it is something that could maybe be added in the README:

I am on a fresh Ubuntu 18.04 installation, have Python 3 out-of-the-box and when I run the script as per the README, I get ModuleNotFoundError: No module named 'pygatt'.

I figured I needed to install the pygatt package using PIP, so installed PIP using sudo apt-get install python3-pip and then ran pip install pygatt. However, this didn't help, the same invocation ends with the same result, even though I believe the pygatt package should be installed now.

Do you know what gives?

Windows Support

Currently with the bleak rewrite, windows should be supported.

There is however an error at the unlock response (notify likely failing to get response):

2021-12-31 14:39:33 INFO     Likely found a onewheel, using ***
2021-12-31 14:39:56 INFO     Services resolved for BleakClientWinRT (***)
2021-12-31 14:40:28 ERROR    Error: timeout reached waiting for encryption key response.
2021-12-31 14:40:28 ERROR    Connection error: Timeout reached waiting for encryption key response
2021-12-31 14:40:28 INFO     Connected to board: None
2021-12-31 14:40:28 WARNING  Unable to read valid data, retrying in 3 sec...
2021-12-31 14:40:31 WARNING  Unable to read valid data, retrying in 3 sec...
2021-12-31 14:40:34 WARNING  Unable to read valid data, retrying in 3 sec...
2021-12-31 14:40:37 WARNING  Unable to read valid data, retrying in 3 sec...
2021-12-31 14:40:41 WARNING  Unable to read valid data, retrying in 3 sec...
2021-12-31 14:40:44 ERROR    Unable able to read valid data, after 5 failed attempts. Exiting.

Pygatt is dead, long live Bleak

Due to a lack of maintainer for pygatt in quite some time and it creating issues. I rewrote and tested this project using bleak.

This should add cross-platform support that was missing and resolve some other issues.

I have tested that everything is working in a fresh python environment (venv) with the included requirements.txt packages against my up to date XR+ as of 12/29/2021.

Zero values when connecting

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

Encryption

Seems like after attempting to connect to the device I get a spam of waiting for encryption key then it times out and disconnects.
Is this a new update for Gemini boards or am I doing something wrong?
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.