kite247 / Onewheel2Garmin

See the battery status of your Onewheel on a Garmin watch
MIT License
14 stars 3 forks source link

Battery voltage? #3

Open arcticcougar opened 3 years ago

arcticcougar commented 3 years ago

@floatangels.

Hi I messaged you on Insta but thought I'd better do it here.

Does FM's OW App allow you to read the battery voltage? I have installed a bigger battery in my Pint so the only way to calculate my battery % is now checking the voltage in the OW app on my phone and trying to convert it in my head to the actual battery % remaining. It would be a big help to me and others in the community that have upgraded their batteries if your app could get the voltage from the OW App and calculate our actual % remaining for display on our garmin watch through your app. No other app is currently able to do this, pOWheel and onewave are both incompatible with my pint at the moment. Great work on the app so far!

kite247 commented 3 years ago

Hi arcticcougar,

unfortunately I do not think that there is a way to get the battery voltage out of the official OW App. All we can access from the OW2Garmin App is the data that is posted in the permanent notification that is shown in the notification center. Currently, this is just the battery percentage, range and a status string (like "Connected to Onewheel").

Until pOWheel or onewave figure out a way to support your Pint, I do not know how this could be solved.

Hopefully someone else here has an idea to make it work.

arcticcougar commented 3 years ago

no worries, thanks for getting back to me so quickly. Just out of interest, what tools do you need to read the info from the OW APP in the first place? I would have no idea where to start with a project like yours, but I'd love to know how it's done.

kite247 commented 3 years ago

To read the contents of the OW App Notification I'm using an Android API called NotificationListenerService.

The exact code can be found in this file: https://github.com/kite247/Onewheel2Garmin/blob/master/AndroidApp/Onewheel2Garmin/app/src/main/java/com/floatangels/onewheel2garmin/MyNotificationListener.kt

onNotificationPosted() is where the data is parsed.